
obj/user/testfile.debug:     file format elf32-i386


Disassembly of section .text:

00800020 <_start>:
// starts us running when we are initially loaded into a new environment.
.text
.globl _start
_start:
	// See if we were started with arguments on the stack
	cmpl $USTACKTOP, %esp
  800020:	81 fc 00 e0 bf ee    	cmp    $0xeebfe000,%esp
	jne args_exist
  800026:	75 04                	jne    80002c <args_exist>

	// If not, push dummy argc/argv arguments.
	// This happens when we are loaded by the kernel,
	// because the kernel does not know about passing arguments.
	pushl $0
  800028:	6a 00                	push   $0x0
	pushl $0
  80002a:	6a 00                	push   $0x0

0080002c <args_exist>:

args_exist:
	call libmain
  80002c:	e8 58 06 00 00       	call   800689 <libmain>
1:	jmp 1b
  800031:	eb fe                	jmp    800031 <args_exist+0x5>

00800033 <xopen>:

#define FVA ((struct Fd*)0xCCCCC000)

static int
xopen(const char *path, int mode)
{
  800033:	55                   	push   %ebp
  800034:	89 e5                	mov    %esp,%ebp
  800036:	53                   	push   %ebx
  800037:	83 ec 0c             	sub    $0xc,%esp
  80003a:	89 d3                	mov    %edx,%ebx
	extern union Fsipc fsipcbuf;
	envid_t fsenv;
	
	strcpy(fsipcbuf.open.req_path, path);
  80003c:	50                   	push   %eax
  80003d:	68 00 50 80 00       	push   $0x805000
  800042:	e8 74 0d 00 00       	call   800dbb <strcpy>
	fsipcbuf.open.req_omode = mode;
  800047:	89 1d 00 54 80 00    	mov    %ebx,0x805400

	fsenv = ipc_find_env(ENV_TYPE_FS);
  80004d:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
  800054:	e8 8e 14 00 00       	call   8014e7 <ipc_find_env>
	ipc_send(fsenv, FSREQ_OPEN, &fsipcbuf, PTE_P | PTE_W | PTE_U);
  800059:	6a 07                	push   $0x7
  80005b:	68 00 50 80 00       	push   $0x805000
  800060:	6a 01                	push   $0x1
  800062:	50                   	push   %eax
  800063:	e8 27 14 00 00       	call   80148f <ipc_send>
	return ipc_recv(NULL, FVA, NULL);
  800068:	83 c4 1c             	add    $0x1c,%esp
  80006b:	6a 00                	push   $0x0
  80006d:	68 00 c0 cc cc       	push   $0xccccc000
  800072:	6a 00                	push   $0x0
  800074:	e8 95 13 00 00       	call   80140e <ipc_recv>
}
  800079:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  80007c:	c9                   	leave  
  80007d:	c3                   	ret    

0080007e <umain>:

void
umain(int argc, char **argv)
{
  80007e:	f3 0f 1e fb          	endbr32 
  800082:	55                   	push   %ebp
  800083:	89 e5                	mov    %esp,%ebp
  800085:	57                   	push   %edi
  800086:	56                   	push   %esi
  800087:	53                   	push   %ebx
  800088:	81 ec ac 02 00 00    	sub    $0x2ac,%esp
	struct Fd fdcopy;
	struct Stat st;
	char buf[512];

	// We open files manually first, to avoid the FD layer
	if ((r = xopen("/not-found", O_RDONLY)) < 0 && r != -E_NOT_FOUND)
  80008e:	ba 00 00 00 00       	mov    $0x0,%edx
  800093:	b8 20 25 80 00       	mov    $0x802520,%eax
  800098:	e8 96 ff ff ff       	call   800033 <xopen>
  80009d:	83 f8 f5             	cmp    $0xfffffff5,%eax
  8000a0:	74 08                	je     8000aa <umain+0x2c>
  8000a2:	85 c0                	test   %eax,%eax
  8000a4:	0f 88 e9 03 00 00    	js     800493 <umain+0x415>
		panic("serve_open /not-found: %e", r);
	else if (r >= 0)
  8000aa:	85 c0                	test   %eax,%eax
  8000ac:	0f 89 f3 03 00 00    	jns    8004a5 <umain+0x427>
		panic("serve_open /not-found succeeded!");

	if ((r = xopen("/newmotd", O_RDONLY)) < 0)
  8000b2:	ba 00 00 00 00       	mov    $0x0,%edx
  8000b7:	b8 55 25 80 00       	mov    $0x802555,%eax
  8000bc:	e8 72 ff ff ff       	call   800033 <xopen>
  8000c1:	85 c0                	test   %eax,%eax
  8000c3:	0f 88 f0 03 00 00    	js     8004b9 <umain+0x43b>
		panic("serve_open /newmotd: %e", r);
	if (FVA->fd_dev_id != 'f' || FVA->fd_offset != 0 || FVA->fd_omode != O_RDONLY)
  8000c9:	83 3d 00 c0 cc cc 66 	cmpl   $0x66,0xccccc000
  8000d0:	0f 85 f5 03 00 00    	jne    8004cb <umain+0x44d>
  8000d6:	83 3d 04 c0 cc cc 00 	cmpl   $0x0,0xccccc004
  8000dd:	0f 85 e8 03 00 00    	jne    8004cb <umain+0x44d>
  8000e3:	83 3d 08 c0 cc cc 00 	cmpl   $0x0,0xccccc008
  8000ea:	0f 85 db 03 00 00    	jne    8004cb <umain+0x44d>
		panic("serve_open did not fill struct Fd correctly\n");
	cprintf("serve_open is good\n");
  8000f0:	83 ec 0c             	sub    $0xc,%esp
  8000f3:	68 76 25 80 00       	push   $0x802576
  8000f8:	e8 e5 06 00 00       	call   8007e2 <cprintf>

	if ((r = devfile.dev_stat(FVA, &st)) < 0)
  8000fd:	83 c4 08             	add    $0x8,%esp
  800100:	8d 85 4c ff ff ff    	lea    -0xb4(%ebp),%eax
  800106:	50                   	push   %eax
  800107:	68 00 c0 cc cc       	push   $0xccccc000
  80010c:	ff 15 1c 30 80 00    	call   *0x80301c
  800112:	83 c4 10             	add    $0x10,%esp
  800115:	85 c0                	test   %eax,%eax
  800117:	0f 88 c2 03 00 00    	js     8004df <umain+0x461>
		panic("file_stat: %e", r);
	if (strlen(msg) != st.st_size)
  80011d:	83 ec 0c             	sub    $0xc,%esp
  800120:	ff 35 00 30 80 00    	pushl  0x803000
  800126:	e8 4d 0c 00 00       	call   800d78 <strlen>
  80012b:	83 c4 10             	add    $0x10,%esp
  80012e:	3b 45 cc             	cmp    -0x34(%ebp),%eax
  800131:	0f 85 ba 03 00 00    	jne    8004f1 <umain+0x473>
		panic("file_stat returned size %d wanted %d\n", st.st_size, strlen(msg));
	cprintf("file_stat is good\n");
  800137:	83 ec 0c             	sub    $0xc,%esp
  80013a:	68 98 25 80 00       	push   $0x802598
  80013f:	e8 9e 06 00 00       	call   8007e2 <cprintf>

	memset(buf, 0, sizeof buf);
  800144:	83 c4 0c             	add    $0xc,%esp
  800147:	68 00 02 00 00       	push   $0x200
  80014c:	6a 00                	push   $0x0
  80014e:	8d 9d 4c fd ff ff    	lea    -0x2b4(%ebp),%ebx
  800154:	53                   	push   %ebx
  800155:	e8 cb 0d 00 00       	call   800f25 <memset>
	if ((r = devfile.dev_read(FVA, buf, sizeof buf)) < 0)
  80015a:	83 c4 0c             	add    $0xc,%esp
  80015d:	68 00 02 00 00       	push   $0x200
  800162:	53                   	push   %ebx
  800163:	68 00 c0 cc cc       	push   $0xccccc000
  800168:	ff 15 10 30 80 00    	call   *0x803010
  80016e:	83 c4 10             	add    $0x10,%esp
  800171:	85 c0                	test   %eax,%eax
  800173:	0f 88 9d 03 00 00    	js     800516 <umain+0x498>
		panic("file_read: %e", r);
	if (strcmp(buf, msg) != 0)
  800179:	83 ec 08             	sub    $0x8,%esp
  80017c:	ff 35 00 30 80 00    	pushl  0x803000
  800182:	8d 85 4c fd ff ff    	lea    -0x2b4(%ebp),%eax
  800188:	50                   	push   %eax
  800189:	e8 ec 0c 00 00       	call   800e7a <strcmp>
  80018e:	83 c4 10             	add    $0x10,%esp
  800191:	85 c0                	test   %eax,%eax
  800193:	0f 85 8f 03 00 00    	jne    800528 <umain+0x4aa>
		panic("file_read returned wrong data");
	cprintf("file_read is good\n");
  800199:	83 ec 0c             	sub    $0xc,%esp
  80019c:	68 d7 25 80 00       	push   $0x8025d7
  8001a1:	e8 3c 06 00 00       	call   8007e2 <cprintf>

	if ((r = devfile.dev_close(FVA)) < 0)
  8001a6:	c7 04 24 00 c0 cc cc 	movl   $0xccccc000,(%esp)
  8001ad:	ff 15 18 30 80 00    	call   *0x803018
  8001b3:	83 c4 10             	add    $0x10,%esp
  8001b6:	85 c0                	test   %eax,%eax
  8001b8:	0f 88 7e 03 00 00    	js     80053c <umain+0x4be>
		panic("file_close: %e", r);
	cprintf("file_close is good\n");
  8001be:	83 ec 0c             	sub    $0xc,%esp
  8001c1:	68 f9 25 80 00       	push   $0x8025f9
  8001c6:	e8 17 06 00 00       	call   8007e2 <cprintf>

	// We're about to unmap the FD, but still need a way to get
	// the stale filenum to serve_read, so we make a local copy.
	// The file server won't think it's stale until we unmap the
	// FD page.
	fdcopy = *FVA;
  8001cb:	a1 00 c0 cc cc       	mov    0xccccc000,%eax
  8001d0:	89 45 d8             	mov    %eax,-0x28(%ebp)
  8001d3:	a1 04 c0 cc cc       	mov    0xccccc004,%eax
  8001d8:	89 45 dc             	mov    %eax,-0x24(%ebp)
  8001db:	a1 08 c0 cc cc       	mov    0xccccc008,%eax
  8001e0:	89 45 e0             	mov    %eax,-0x20(%ebp)
  8001e3:	a1 0c c0 cc cc       	mov    0xccccc00c,%eax
  8001e8:	89 45 e4             	mov    %eax,-0x1c(%ebp)
	sys_page_unmap(0, FVA);
  8001eb:	83 c4 08             	add    $0x8,%esp
  8001ee:	68 00 c0 cc cc       	push   $0xccccc000
  8001f3:	6a 00                	push   $0x0
  8001f5:	e8 90 10 00 00       	call   80128a <sys_page_unmap>

	if ((r = devfile.dev_read(&fdcopy, buf, sizeof buf)) != -E_INVAL)
  8001fa:	83 c4 0c             	add    $0xc,%esp
  8001fd:	68 00 02 00 00       	push   $0x200
  800202:	8d 85 4c fd ff ff    	lea    -0x2b4(%ebp),%eax
  800208:	50                   	push   %eax
  800209:	8d 45 d8             	lea    -0x28(%ebp),%eax
  80020c:	50                   	push   %eax
  80020d:	ff 15 10 30 80 00    	call   *0x803010
  800213:	83 c4 10             	add    $0x10,%esp
  800216:	83 f8 fd             	cmp    $0xfffffffd,%eax
  800219:	0f 85 2f 03 00 00    	jne    80054e <umain+0x4d0>
		panic("serve_read does not handle stale fileids correctly: %e", r);
	cprintf("stale fileid is good\n");
  80021f:	83 ec 0c             	sub    $0xc,%esp
  800222:	68 0d 26 80 00       	push   $0x80260d
  800227:	e8 b6 05 00 00       	call   8007e2 <cprintf>

	// Try writing
	if ((r = xopen("/new-file", O_RDWR|O_CREAT)) < 0)
  80022c:	ba 02 01 00 00       	mov    $0x102,%edx
  800231:	b8 23 26 80 00       	mov    $0x802623,%eax
  800236:	e8 f8 fd ff ff       	call   800033 <xopen>
  80023b:	83 c4 10             	add    $0x10,%esp
  80023e:	85 c0                	test   %eax,%eax
  800240:	0f 88 1a 03 00 00    	js     800560 <umain+0x4e2>
		panic("serve_open /new-file: %e", r);

	if ((r = devfile.dev_write(FVA, msg, strlen(msg))) != strlen(msg))
  800246:	8b 1d 14 30 80 00    	mov    0x803014,%ebx
  80024c:	83 ec 0c             	sub    $0xc,%esp
  80024f:	ff 35 00 30 80 00    	pushl  0x803000
  800255:	e8 1e 0b 00 00       	call   800d78 <strlen>
  80025a:	83 c4 0c             	add    $0xc,%esp
  80025d:	50                   	push   %eax
  80025e:	ff 35 00 30 80 00    	pushl  0x803000
  800264:	68 00 c0 cc cc       	push   $0xccccc000
  800269:	ff d3                	call   *%ebx
  80026b:	89 c3                	mov    %eax,%ebx
  80026d:	83 c4 04             	add    $0x4,%esp
  800270:	ff 35 00 30 80 00    	pushl  0x803000
  800276:	e8 fd 0a 00 00       	call   800d78 <strlen>
  80027b:	83 c4 10             	add    $0x10,%esp
  80027e:	39 d8                	cmp    %ebx,%eax
  800280:	0f 85 ec 02 00 00    	jne    800572 <umain+0x4f4>
		panic("file_write: %e", r);
	cprintf("file_write is good\n");
  800286:	83 ec 0c             	sub    $0xc,%esp
  800289:	68 55 26 80 00       	push   $0x802655
  80028e:	e8 4f 05 00 00       	call   8007e2 <cprintf>

	FVA->fd_offset = 0;
  800293:	c7 05 04 c0 cc cc 00 	movl   $0x0,0xccccc004
  80029a:	00 00 00 
	memset(buf, 0, sizeof buf);
  80029d:	83 c4 0c             	add    $0xc,%esp
  8002a0:	68 00 02 00 00       	push   $0x200
  8002a5:	6a 00                	push   $0x0
  8002a7:	8d 9d 4c fd ff ff    	lea    -0x2b4(%ebp),%ebx
  8002ad:	53                   	push   %ebx
  8002ae:	e8 72 0c 00 00       	call   800f25 <memset>
	if ((r = devfile.dev_read(FVA, buf, sizeof buf)) < 0)
  8002b3:	83 c4 0c             	add    $0xc,%esp
  8002b6:	68 00 02 00 00       	push   $0x200
  8002bb:	53                   	push   %ebx
  8002bc:	68 00 c0 cc cc       	push   $0xccccc000
  8002c1:	ff 15 10 30 80 00    	call   *0x803010
  8002c7:	89 c3                	mov    %eax,%ebx
  8002c9:	83 c4 10             	add    $0x10,%esp
  8002cc:	85 c0                	test   %eax,%eax
  8002ce:	0f 88 b0 02 00 00    	js     800584 <umain+0x506>
		panic("file_read after file_write: %e", r);
	if (r != strlen(msg))
  8002d4:	83 ec 0c             	sub    $0xc,%esp
  8002d7:	ff 35 00 30 80 00    	pushl  0x803000
  8002dd:	e8 96 0a 00 00       	call   800d78 <strlen>
  8002e2:	83 c4 10             	add    $0x10,%esp
  8002e5:	39 d8                	cmp    %ebx,%eax
  8002e7:	0f 85 a9 02 00 00    	jne    800596 <umain+0x518>
		panic("file_read after file_write returned wrong length: %d", r);
	if (strcmp(buf, msg) != 0)
  8002ed:	83 ec 08             	sub    $0x8,%esp
  8002f0:	ff 35 00 30 80 00    	pushl  0x803000
  8002f6:	8d 85 4c fd ff ff    	lea    -0x2b4(%ebp),%eax
  8002fc:	50                   	push   %eax
  8002fd:	e8 78 0b 00 00       	call   800e7a <strcmp>
  800302:	83 c4 10             	add    $0x10,%esp
  800305:	85 c0                	test   %eax,%eax
  800307:	0f 85 9b 02 00 00    	jne    8005a8 <umain+0x52a>
		panic("file_read after file_write returned wrong data");
	cprintf("file_read after file_write is good\n");
  80030d:	83 ec 0c             	sub    $0xc,%esp
  800310:	68 1c 28 80 00       	push   $0x80281c
  800315:	e8 c8 04 00 00       	call   8007e2 <cprintf>

	// Now we'll try out open
	if ((r = open("/not-found", O_RDONLY)) < 0 && r != -E_NOT_FOUND)
  80031a:	83 c4 08             	add    $0x8,%esp
  80031d:	6a 00                	push   $0x0
  80031f:	68 20 25 80 00       	push   $0x802520
  800324:	e8 98 19 00 00       	call   801cc1 <open>
  800329:	83 c4 10             	add    $0x10,%esp
  80032c:	83 f8 f5             	cmp    $0xfffffff5,%eax
  80032f:	74 08                	je     800339 <umain+0x2bb>
  800331:	85 c0                	test   %eax,%eax
  800333:	0f 88 83 02 00 00    	js     8005bc <umain+0x53e>
		panic("open /not-found: %e", r);
	else if (r >= 0)
  800339:	85 c0                	test   %eax,%eax
  80033b:	0f 89 8d 02 00 00    	jns    8005ce <umain+0x550>
		panic("open /not-found succeeded!");

	if ((r = open("/newmotd", O_RDONLY)) < 0)
  800341:	83 ec 08             	sub    $0x8,%esp
  800344:	6a 00                	push   $0x0
  800346:	68 55 25 80 00       	push   $0x802555
  80034b:	e8 71 19 00 00       	call   801cc1 <open>
  800350:	83 c4 10             	add    $0x10,%esp
  800353:	85 c0                	test   %eax,%eax
  800355:	0f 88 87 02 00 00    	js     8005e2 <umain+0x564>
		panic("open /newmotd: %e", r);
	fd = (struct Fd*) (0xD0000000 + r*PGSIZE);
  80035b:	c1 e0 0c             	shl    $0xc,%eax
	if (fd->fd_dev_id != 'f' || fd->fd_offset != 0 || fd->fd_omode != O_RDONLY)
  80035e:	83 b8 00 00 00 d0 66 	cmpl   $0x66,-0x30000000(%eax)
  800365:	0f 85 89 02 00 00    	jne    8005f4 <umain+0x576>
  80036b:	83 b8 04 00 00 d0 00 	cmpl   $0x0,-0x2ffffffc(%eax)
  800372:	0f 85 7c 02 00 00    	jne    8005f4 <umain+0x576>
  800378:	8b 98 08 00 00 d0    	mov    -0x2ffffff8(%eax),%ebx
  80037e:	85 db                	test   %ebx,%ebx
  800380:	0f 85 6e 02 00 00    	jne    8005f4 <umain+0x576>
		panic("open did not fill struct Fd correctly\n");
	cprintf("open is good\n");
  800386:	83 ec 0c             	sub    $0xc,%esp
  800389:	68 7c 25 80 00       	push   $0x80257c
  80038e:	e8 4f 04 00 00       	call   8007e2 <cprintf>

	// Try files with indirect blocks
	if ((f = open("/big", O_WRONLY|O_CREAT)) < 0)
  800393:	83 c4 08             	add    $0x8,%esp
  800396:	68 01 01 00 00       	push   $0x101
  80039b:	68 84 26 80 00       	push   $0x802684
  8003a0:	e8 1c 19 00 00       	call   801cc1 <open>
  8003a5:	89 c7                	mov    %eax,%edi
  8003a7:	83 c4 10             	add    $0x10,%esp
  8003aa:	85 c0                	test   %eax,%eax
  8003ac:	0f 88 56 02 00 00    	js     800608 <umain+0x58a>
		panic("creat /big: %e", f);
	memset(buf, 0, sizeof(buf));
  8003b2:	83 ec 04             	sub    $0x4,%esp
  8003b5:	68 00 02 00 00       	push   $0x200
  8003ba:	6a 00                	push   $0x0
  8003bc:	8d 85 4c fd ff ff    	lea    -0x2b4(%ebp),%eax
  8003c2:	50                   	push   %eax
  8003c3:	e8 5d 0b 00 00       	call   800f25 <memset>
  8003c8:	83 c4 10             	add    $0x10,%esp
	for (i = 0; i < (NDIRECT*3)*BLKSIZE; i += sizeof(buf)) {
  8003cb:	89 de                	mov    %ebx,%esi
		*(int*)buf = i;
  8003cd:	89 b5 4c fd ff ff    	mov    %esi,-0x2b4(%ebp)
		if ((r = write(f, buf, sizeof(buf))) < 0)
  8003d3:	83 ec 04             	sub    $0x4,%esp
  8003d6:	68 00 02 00 00       	push   $0x200
  8003db:	8d 85 4c fd ff ff    	lea    -0x2b4(%ebp),%eax
  8003e1:	50                   	push   %eax
  8003e2:	57                   	push   %edi
  8003e3:	e8 1a 15 00 00       	call   801902 <write>
  8003e8:	83 c4 10             	add    $0x10,%esp
  8003eb:	85 c0                	test   %eax,%eax
  8003ed:	0f 88 27 02 00 00    	js     80061a <umain+0x59c>
  8003f3:	81 c6 00 02 00 00    	add    $0x200,%esi
	for (i = 0; i < (NDIRECT*3)*BLKSIZE; i += sizeof(buf)) {
  8003f9:	81 fe 00 e0 01 00    	cmp    $0x1e000,%esi
  8003ff:	75 cc                	jne    8003cd <umain+0x34f>
			panic("write /big@%d: %e", i, r);
	}
	close(f);
  800401:	83 ec 0c             	sub    $0xc,%esp
  800404:	57                   	push   %edi
  800405:	e8 d8 12 00 00       	call   8016e2 <close>

	if ((f = open("/big", O_RDONLY)) < 0)
  80040a:	83 c4 08             	add    $0x8,%esp
  80040d:	6a 00                	push   $0x0
  80040f:	68 84 26 80 00       	push   $0x802684
  800414:	e8 a8 18 00 00       	call   801cc1 <open>
  800419:	89 c6                	mov    %eax,%esi
  80041b:	83 c4 10             	add    $0x10,%esp
  80041e:	85 c0                	test   %eax,%eax
  800420:	0f 88 0a 02 00 00    	js     800630 <umain+0x5b2>
		panic("open /big: %e", f);
	for (i = 0; i < (NDIRECT*3)*BLKSIZE; i += sizeof(buf)) {
		*(int*)buf = i;
		if ((r = readn(f, buf, sizeof(buf))) < 0)
  800426:	8d bd 4c fd ff ff    	lea    -0x2b4(%ebp),%edi
		*(int*)buf = i;
  80042c:	89 9d 4c fd ff ff    	mov    %ebx,-0x2b4(%ebp)
		if ((r = readn(f, buf, sizeof(buf))) < 0)
  800432:	83 ec 04             	sub    $0x4,%esp
  800435:	68 00 02 00 00       	push   $0x200
  80043a:	57                   	push   %edi
  80043b:	56                   	push   %esi
  80043c:	e8 76 14 00 00       	call   8018b7 <readn>
  800441:	83 c4 10             	add    $0x10,%esp
  800444:	85 c0                	test   %eax,%eax
  800446:	0f 88 f6 01 00 00    	js     800642 <umain+0x5c4>
			panic("read /big@%d: %e", i, r);
		if (r != sizeof(buf))
  80044c:	3d 00 02 00 00       	cmp    $0x200,%eax
  800451:	0f 85 01 02 00 00    	jne    800658 <umain+0x5da>
			panic("read /big from %d returned %d < %d bytes",
			      i, r, sizeof(buf));
		if (*(int*)buf != i)
  800457:	8b 85 4c fd ff ff    	mov    -0x2b4(%ebp),%eax
  80045d:	39 d8                	cmp    %ebx,%eax
  80045f:	0f 85 0e 02 00 00    	jne    800673 <umain+0x5f5>
  800465:	81 c3 00 02 00 00    	add    $0x200,%ebx
	for (i = 0; i < (NDIRECT*3)*BLKSIZE; i += sizeof(buf)) {
  80046b:	81 fb 00 e0 01 00    	cmp    $0x1e000,%ebx
  800471:	75 b9                	jne    80042c <umain+0x3ae>
			panic("read /big from %d returned bad data %d",
			      i, *(int*)buf);
	}
	close(f);
  800473:	83 ec 0c             	sub    $0xc,%esp
  800476:	56                   	push   %esi
  800477:	e8 66 12 00 00       	call   8016e2 <close>
	cprintf("large file is good\n");
  80047c:	c7 04 24 c9 26 80 00 	movl   $0x8026c9,(%esp)
  800483:	e8 5a 03 00 00       	call   8007e2 <cprintf>
}
  800488:	83 c4 10             	add    $0x10,%esp
  80048b:	8d 65 f4             	lea    -0xc(%ebp),%esp
  80048e:	5b                   	pop    %ebx
  80048f:	5e                   	pop    %esi
  800490:	5f                   	pop    %edi
  800491:	5d                   	pop    %ebp
  800492:	c3                   	ret    
		panic("serve_open /not-found: %e", r);
  800493:	50                   	push   %eax
  800494:	68 2b 25 80 00       	push   $0x80252b
  800499:	6a 20                	push   $0x20
  80049b:	68 45 25 80 00       	push   $0x802545
  8004a0:	e8 56 02 00 00       	call   8006fb <_panic>
		panic("serve_open /not-found succeeded!");
  8004a5:	83 ec 04             	sub    $0x4,%esp
  8004a8:	68 e0 26 80 00       	push   $0x8026e0
  8004ad:	6a 22                	push   $0x22
  8004af:	68 45 25 80 00       	push   $0x802545
  8004b4:	e8 42 02 00 00       	call   8006fb <_panic>
		panic("serve_open /newmotd: %e", r);
  8004b9:	50                   	push   %eax
  8004ba:	68 5e 25 80 00       	push   $0x80255e
  8004bf:	6a 25                	push   $0x25
  8004c1:	68 45 25 80 00       	push   $0x802545
  8004c6:	e8 30 02 00 00       	call   8006fb <_panic>
		panic("serve_open did not fill struct Fd correctly\n");
  8004cb:	83 ec 04             	sub    $0x4,%esp
  8004ce:	68 04 27 80 00       	push   $0x802704
  8004d3:	6a 27                	push   $0x27
  8004d5:	68 45 25 80 00       	push   $0x802545
  8004da:	e8 1c 02 00 00       	call   8006fb <_panic>
		panic("file_stat: %e", r);
  8004df:	50                   	push   %eax
  8004e0:	68 8a 25 80 00       	push   $0x80258a
  8004e5:	6a 2b                	push   $0x2b
  8004e7:	68 45 25 80 00       	push   $0x802545
  8004ec:	e8 0a 02 00 00       	call   8006fb <_panic>
		panic("file_stat returned size %d wanted %d\n", st.st_size, strlen(msg));
  8004f1:	83 ec 0c             	sub    $0xc,%esp
  8004f4:	ff 35 00 30 80 00    	pushl  0x803000
  8004fa:	e8 79 08 00 00       	call   800d78 <strlen>
  8004ff:	89 04 24             	mov    %eax,(%esp)
  800502:	ff 75 cc             	pushl  -0x34(%ebp)
  800505:	68 34 27 80 00       	push   $0x802734
  80050a:	6a 2d                	push   $0x2d
  80050c:	68 45 25 80 00       	push   $0x802545
  800511:	e8 e5 01 00 00       	call   8006fb <_panic>
		panic("file_read: %e", r);
  800516:	50                   	push   %eax
  800517:	68 ab 25 80 00       	push   $0x8025ab
  80051c:	6a 32                	push   $0x32
  80051e:	68 45 25 80 00       	push   $0x802545
  800523:	e8 d3 01 00 00       	call   8006fb <_panic>
		panic("file_read returned wrong data");
  800528:	83 ec 04             	sub    $0x4,%esp
  80052b:	68 b9 25 80 00       	push   $0x8025b9
  800530:	6a 34                	push   $0x34
  800532:	68 45 25 80 00       	push   $0x802545
  800537:	e8 bf 01 00 00       	call   8006fb <_panic>
		panic("file_close: %e", r);
  80053c:	50                   	push   %eax
  80053d:	68 ea 25 80 00       	push   $0x8025ea
  800542:	6a 38                	push   $0x38
  800544:	68 45 25 80 00       	push   $0x802545
  800549:	e8 ad 01 00 00       	call   8006fb <_panic>
		panic("serve_read does not handle stale fileids correctly: %e", r);
  80054e:	50                   	push   %eax
  80054f:	68 5c 27 80 00       	push   $0x80275c
  800554:	6a 43                	push   $0x43
  800556:	68 45 25 80 00       	push   $0x802545
  80055b:	e8 9b 01 00 00       	call   8006fb <_panic>
		panic("serve_open /new-file: %e", r);
  800560:	50                   	push   %eax
  800561:	68 2d 26 80 00       	push   $0x80262d
  800566:	6a 48                	push   $0x48
  800568:	68 45 25 80 00       	push   $0x802545
  80056d:	e8 89 01 00 00       	call   8006fb <_panic>
		panic("file_write: %e", r);
  800572:	53                   	push   %ebx
  800573:	68 46 26 80 00       	push   $0x802646
  800578:	6a 4b                	push   $0x4b
  80057a:	68 45 25 80 00       	push   $0x802545
  80057f:	e8 77 01 00 00       	call   8006fb <_panic>
		panic("file_read after file_write: %e", r);
  800584:	50                   	push   %eax
  800585:	68 94 27 80 00       	push   $0x802794
  80058a:	6a 51                	push   $0x51
  80058c:	68 45 25 80 00       	push   $0x802545
  800591:	e8 65 01 00 00       	call   8006fb <_panic>
		panic("file_read after file_write returned wrong length: %d", r);
  800596:	53                   	push   %ebx
  800597:	68 b4 27 80 00       	push   $0x8027b4
  80059c:	6a 53                	push   $0x53
  80059e:	68 45 25 80 00       	push   $0x802545
  8005a3:	e8 53 01 00 00       	call   8006fb <_panic>
		panic("file_read after file_write returned wrong data");
  8005a8:	83 ec 04             	sub    $0x4,%esp
  8005ab:	68 ec 27 80 00       	push   $0x8027ec
  8005b0:	6a 55                	push   $0x55
  8005b2:	68 45 25 80 00       	push   $0x802545
  8005b7:	e8 3f 01 00 00       	call   8006fb <_panic>
		panic("open /not-found: %e", r);
  8005bc:	50                   	push   %eax
  8005bd:	68 31 25 80 00       	push   $0x802531
  8005c2:	6a 5a                	push   $0x5a
  8005c4:	68 45 25 80 00       	push   $0x802545
  8005c9:	e8 2d 01 00 00       	call   8006fb <_panic>
		panic("open /not-found succeeded!");
  8005ce:	83 ec 04             	sub    $0x4,%esp
  8005d1:	68 69 26 80 00       	push   $0x802669
  8005d6:	6a 5c                	push   $0x5c
  8005d8:	68 45 25 80 00       	push   $0x802545
  8005dd:	e8 19 01 00 00       	call   8006fb <_panic>
		panic("open /newmotd: %e", r);
  8005e2:	50                   	push   %eax
  8005e3:	68 64 25 80 00       	push   $0x802564
  8005e8:	6a 5f                	push   $0x5f
  8005ea:	68 45 25 80 00       	push   $0x802545
  8005ef:	e8 07 01 00 00       	call   8006fb <_panic>
		panic("open did not fill struct Fd correctly\n");
  8005f4:	83 ec 04             	sub    $0x4,%esp
  8005f7:	68 40 28 80 00       	push   $0x802840
  8005fc:	6a 62                	push   $0x62
  8005fe:	68 45 25 80 00       	push   $0x802545
  800603:	e8 f3 00 00 00       	call   8006fb <_panic>
		panic("creat /big: %e", f);
  800608:	50                   	push   %eax
  800609:	68 89 26 80 00       	push   $0x802689
  80060e:	6a 67                	push   $0x67
  800610:	68 45 25 80 00       	push   $0x802545
  800615:	e8 e1 00 00 00       	call   8006fb <_panic>
			panic("write /big@%d: %e", i, r);
  80061a:	83 ec 0c             	sub    $0xc,%esp
  80061d:	50                   	push   %eax
  80061e:	56                   	push   %esi
  80061f:	68 98 26 80 00       	push   $0x802698
  800624:	6a 6c                	push   $0x6c
  800626:	68 45 25 80 00       	push   $0x802545
  80062b:	e8 cb 00 00 00       	call   8006fb <_panic>
		panic("open /big: %e", f);
  800630:	50                   	push   %eax
  800631:	68 aa 26 80 00       	push   $0x8026aa
  800636:	6a 71                	push   $0x71
  800638:	68 45 25 80 00       	push   $0x802545
  80063d:	e8 b9 00 00 00       	call   8006fb <_panic>
			panic("read /big@%d: %e", i, r);
  800642:	83 ec 0c             	sub    $0xc,%esp
  800645:	50                   	push   %eax
  800646:	53                   	push   %ebx
  800647:	68 b8 26 80 00       	push   $0x8026b8
  80064c:	6a 75                	push   $0x75
  80064e:	68 45 25 80 00       	push   $0x802545
  800653:	e8 a3 00 00 00       	call   8006fb <_panic>
			panic("read /big from %d returned %d < %d bytes",
  800658:	83 ec 08             	sub    $0x8,%esp
  80065b:	68 00 02 00 00       	push   $0x200
  800660:	50                   	push   %eax
  800661:	53                   	push   %ebx
  800662:	68 68 28 80 00       	push   $0x802868
  800667:	6a 77                	push   $0x77
  800669:	68 45 25 80 00       	push   $0x802545
  80066e:	e8 88 00 00 00       	call   8006fb <_panic>
			panic("read /big from %d returned bad data %d",
  800673:	83 ec 0c             	sub    $0xc,%esp
  800676:	50                   	push   %eax
  800677:	53                   	push   %ebx
  800678:	68 94 28 80 00       	push   $0x802894
  80067d:	6a 7a                	push   $0x7a
  80067f:	68 45 25 80 00       	push   $0x802545
  800684:	e8 72 00 00 00       	call   8006fb <_panic>

00800689 <libmain>:
const volatile struct Env *thisenv;
const char *binaryname = "<unknown>";

void
libmain(int argc, char **argv)
{
  800689:	f3 0f 1e fb          	endbr32 
  80068d:	55                   	push   %ebp
  80068e:	89 e5                	mov    %esp,%ebp
  800690:	56                   	push   %esi
  800691:	53                   	push   %ebx
  800692:	8b 5d 08             	mov    0x8(%ebp),%ebx
  800695:	8b 75 0c             	mov    0xc(%ebp),%esi
	;    //系统调用，我们已经在Exercise 7中实现了
	
	
	
	//屏幕上打印出来了字母，但后续报错了，有意思，让我看看问题出现在哪。
	thisenv=0;
  800698:	c7 05 04 40 80 00 00 	movl   $0x0,0x804004
  80069f:	00 00 00 
	thisenv = &envs[ENVX(sys_getenvid())];      //获取Env结构指针
  8006a2:	e8 10 0b 00 00       	call   8011b7 <sys_getenvid>
  8006a7:	25 ff 03 00 00       	and    $0x3ff,%eax
  8006ac:	6b c0 7c             	imul   $0x7c,%eax,%eax
  8006af:	05 00 00 c0 ee       	add    $0xeec00000,%eax
  8006b4:	a3 04 40 80 00       	mov    %eax,0x804004

	// save the name of the program so that panic() can use it
	if (argc > 0)
  8006b9:	85 db                	test   %ebx,%ebx
  8006bb:	7e 07                	jle    8006c4 <libmain+0x3b>
		binaryname = argv[0];
  8006bd:	8b 06                	mov    (%esi),%eax
  8006bf:	a3 04 30 80 00       	mov    %eax,0x803004

	// call user main routine
	umain(argc, argv);
  8006c4:	83 ec 08             	sub    $0x8,%esp
  8006c7:	56                   	push   %esi
  8006c8:	53                   	push   %ebx
  8006c9:	e8 b0 f9 ff ff       	call   80007e <umain>

	// exit gracefully
	exit();
  8006ce:	e8 0a 00 00 00       	call   8006dd <exit>
}
  8006d3:	83 c4 10             	add    $0x10,%esp
  8006d6:	8d 65 f8             	lea    -0x8(%ebp),%esp
  8006d9:	5b                   	pop    %ebx
  8006da:	5e                   	pop    %esi
  8006db:	5d                   	pop    %ebp
  8006dc:	c3                   	ret    

008006dd <exit>:

#include <inc/lib.h>

void
exit(void)
{
  8006dd:	f3 0f 1e fb          	endbr32 
  8006e1:	55                   	push   %ebp
  8006e2:	89 e5                	mov    %esp,%ebp
  8006e4:	83 ec 08             	sub    $0x8,%esp
	close_all();
  8006e7:	e8 27 10 00 00       	call   801713 <close_all>
	sys_env_destroy(0);
  8006ec:	83 ec 0c             	sub    $0xc,%esp
  8006ef:	6a 00                	push   $0x0
  8006f1:	e8 7c 0a 00 00       	call   801172 <sys_env_destroy>
}
  8006f6:	83 c4 10             	add    $0x10,%esp
  8006f9:	c9                   	leave  
  8006fa:	c3                   	ret    

008006fb <_panic>:
 * It prints "panic: <message>", then causes a breakpoint exception,
 * which causes JOS to enter the JOS kernel monitor.
 */
void
_panic(const char *file, int line, const char *fmt, ...)
{
  8006fb:	f3 0f 1e fb          	endbr32 
  8006ff:	55                   	push   %ebp
  800700:	89 e5                	mov    %esp,%ebp
  800702:	56                   	push   %esi
  800703:	53                   	push   %ebx
	va_list ap;

	va_start(ap, fmt);
  800704:	8d 5d 14             	lea    0x14(%ebp),%ebx

	// Print the panic message
	cprintf("[%08x] user panic in %s at %s:%d: ",
  800707:	8b 35 04 30 80 00    	mov    0x803004,%esi
  80070d:	e8 a5 0a 00 00       	call   8011b7 <sys_getenvid>
  800712:	83 ec 0c             	sub    $0xc,%esp
  800715:	ff 75 0c             	pushl  0xc(%ebp)
  800718:	ff 75 08             	pushl  0x8(%ebp)
  80071b:	56                   	push   %esi
  80071c:	50                   	push   %eax
  80071d:	68 ec 28 80 00       	push   $0x8028ec
  800722:	e8 bb 00 00 00       	call   8007e2 <cprintf>
		sys_getenvid(), binaryname, file, line);
	vcprintf(fmt, ap);
  800727:	83 c4 18             	add    $0x18,%esp
  80072a:	53                   	push   %ebx
  80072b:	ff 75 10             	pushl  0x10(%ebp)
  80072e:	e8 5a 00 00 00       	call   80078d <vcprintf>
	cprintf("\n");
  800733:	c7 04 24 3f 2d 80 00 	movl   $0x802d3f,(%esp)
  80073a:	e8 a3 00 00 00       	call   8007e2 <cprintf>
  80073f:	83 c4 10             	add    $0x10,%esp

	// Cause a breakpoint exception
	while (1)
		asm volatile("int3");
  800742:	cc                   	int3   
  800743:	eb fd                	jmp    800742 <_panic+0x47>

00800745 <putch>:
};


static void
putch(int ch, struct printbuf *b)
{
  800745:	f3 0f 1e fb          	endbr32 
  800749:	55                   	push   %ebp
  80074a:	89 e5                	mov    %esp,%ebp
  80074c:	53                   	push   %ebx
  80074d:	83 ec 04             	sub    $0x4,%esp
  800750:	8b 5d 0c             	mov    0xc(%ebp),%ebx
	b->buf[b->idx++] = ch;
  800753:	8b 13                	mov    (%ebx),%edx
  800755:	8d 42 01             	lea    0x1(%edx),%eax
  800758:	89 03                	mov    %eax,(%ebx)
  80075a:	8b 4d 08             	mov    0x8(%ebp),%ecx
  80075d:	88 4c 13 08          	mov    %cl,0x8(%ebx,%edx,1)
	if (b->idx == 256-1) {
  800761:	3d ff 00 00 00       	cmp    $0xff,%eax
  800766:	74 09                	je     800771 <putch+0x2c>
		sys_cputs(b->buf, b->idx);
		b->idx = 0;
	}
	b->cnt++;
  800768:	83 43 04 01          	addl   $0x1,0x4(%ebx)
}
  80076c:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  80076f:	c9                   	leave  
  800770:	c3                   	ret    
		sys_cputs(b->buf, b->idx);
  800771:	83 ec 08             	sub    $0x8,%esp
  800774:	68 ff 00 00 00       	push   $0xff
  800779:	8d 43 08             	lea    0x8(%ebx),%eax
  80077c:	50                   	push   %eax
  80077d:	e8 ab 09 00 00       	call   80112d <sys_cputs>
		b->idx = 0;
  800782:	c7 03 00 00 00 00    	movl   $0x0,(%ebx)
  800788:	83 c4 10             	add    $0x10,%esp
  80078b:	eb db                	jmp    800768 <putch+0x23>

0080078d <vcprintf>:

int
vcprintf(const char *fmt, va_list ap)
{
  80078d:	f3 0f 1e fb          	endbr32 
  800791:	55                   	push   %ebp
  800792:	89 e5                	mov    %esp,%ebp
  800794:	81 ec 18 01 00 00    	sub    $0x118,%esp
	struct printbuf b;

	b.idx = 0;
  80079a:	c7 85 f0 fe ff ff 00 	movl   $0x0,-0x110(%ebp)
  8007a1:	00 00 00 
	b.cnt = 0;
  8007a4:	c7 85 f4 fe ff ff 00 	movl   $0x0,-0x10c(%ebp)
  8007ab:	00 00 00 
	vprintfmt((void*)putch, &b, fmt, ap);
  8007ae:	ff 75 0c             	pushl  0xc(%ebp)
  8007b1:	ff 75 08             	pushl  0x8(%ebp)
  8007b4:	8d 85 f0 fe ff ff    	lea    -0x110(%ebp),%eax
  8007ba:	50                   	push   %eax
  8007bb:	68 45 07 80 00       	push   $0x800745
  8007c0:	e8 20 01 00 00       	call   8008e5 <vprintfmt>
	sys_cputs(b.buf, b.idx);
  8007c5:	83 c4 08             	add    $0x8,%esp
  8007c8:	ff b5 f0 fe ff ff    	pushl  -0x110(%ebp)
  8007ce:	8d 85 f8 fe ff ff    	lea    -0x108(%ebp),%eax
  8007d4:	50                   	push   %eax
  8007d5:	e8 53 09 00 00       	call   80112d <sys_cputs>

	return b.cnt;
}
  8007da:	8b 85 f4 fe ff ff    	mov    -0x10c(%ebp),%eax
  8007e0:	c9                   	leave  
  8007e1:	c3                   	ret    

008007e2 <cprintf>:

int
cprintf(const char *fmt, ...)
{
  8007e2:	f3 0f 1e fb          	endbr32 
  8007e6:	55                   	push   %ebp
  8007e7:	89 e5                	mov    %esp,%ebp
  8007e9:	83 ec 10             	sub    $0x10,%esp
	va_list ap;
	int cnt;

	va_start(ap, fmt);
  8007ec:	8d 45 0c             	lea    0xc(%ebp),%eax
	cnt = vcprintf(fmt, ap);
  8007ef:	50                   	push   %eax
  8007f0:	ff 75 08             	pushl  0x8(%ebp)
  8007f3:	e8 95 ff ff ff       	call   80078d <vcprintf>
	va_end(ap);

	return cnt;
}
  8007f8:	c9                   	leave  
  8007f9:	c3                   	ret    

008007fa <printnum>:
 * using specified putch function and associated pointer putdat.
 */
static void
printnum(void (*putch)(int, void*), void *putdat,
	 unsigned long long num, unsigned base, int width, int padc)
{
  8007fa:	55                   	push   %ebp
  8007fb:	89 e5                	mov    %esp,%ebp
  8007fd:	57                   	push   %edi
  8007fe:	56                   	push   %esi
  8007ff:	53                   	push   %ebx
  800800:	83 ec 1c             	sub    $0x1c,%esp
  800803:	89 c7                	mov    %eax,%edi
  800805:	89 d6                	mov    %edx,%esi
  800807:	8b 45 08             	mov    0x8(%ebp),%eax
  80080a:	8b 55 0c             	mov    0xc(%ebp),%edx
  80080d:	89 d1                	mov    %edx,%ecx
  80080f:	89 c2                	mov    %eax,%edx
  800811:	89 45 d8             	mov    %eax,-0x28(%ebp)
  800814:	89 4d dc             	mov    %ecx,-0x24(%ebp)
  800817:	8b 45 10             	mov    0x10(%ebp),%eax
  80081a:	8b 5d 14             	mov    0x14(%ebp),%ebx
	// first recursively print all preceding (more significant) digits
	if (num >= base) {
  80081d:	89 45 e0             	mov    %eax,-0x20(%ebp)
  800820:	c7 45 e4 00 00 00 00 	movl   $0x0,-0x1c(%ebp)
  800827:	39 c2                	cmp    %eax,%edx
  800829:	1b 4d e4             	sbb    -0x1c(%ebp),%ecx
  80082c:	72 3e                	jb     80086c <printnum+0x72>
		printnum(putch, putdat, num / base, base, width - 1, padc);
  80082e:	83 ec 0c             	sub    $0xc,%esp
  800831:	ff 75 18             	pushl  0x18(%ebp)
  800834:	83 eb 01             	sub    $0x1,%ebx
  800837:	53                   	push   %ebx
  800838:	50                   	push   %eax
  800839:	83 ec 08             	sub    $0x8,%esp
  80083c:	ff 75 e4             	pushl  -0x1c(%ebp)
  80083f:	ff 75 e0             	pushl  -0x20(%ebp)
  800842:	ff 75 dc             	pushl  -0x24(%ebp)
  800845:	ff 75 d8             	pushl  -0x28(%ebp)
  800848:	e8 63 1a 00 00       	call   8022b0 <__udivdi3>
  80084d:	83 c4 18             	add    $0x18,%esp
  800850:	52                   	push   %edx
  800851:	50                   	push   %eax
  800852:	89 f2                	mov    %esi,%edx
  800854:	89 f8                	mov    %edi,%eax
  800856:	e8 9f ff ff ff       	call   8007fa <printnum>
  80085b:	83 c4 20             	add    $0x20,%esp
  80085e:	eb 13                	jmp    800873 <printnum+0x79>
	} else {
		// print any needed pad characters before first digit
		while (--width > 0)
			putch(padc, putdat);
  800860:	83 ec 08             	sub    $0x8,%esp
  800863:	56                   	push   %esi
  800864:	ff 75 18             	pushl  0x18(%ebp)
  800867:	ff d7                	call   *%edi
  800869:	83 c4 10             	add    $0x10,%esp
		while (--width > 0)
  80086c:	83 eb 01             	sub    $0x1,%ebx
  80086f:	85 db                	test   %ebx,%ebx
  800871:	7f ed                	jg     800860 <printnum+0x66>
	}

	// then print this (the least significant) digit
	putch("0123456789abcdef"[num % base], putdat);
  800873:	83 ec 08             	sub    $0x8,%esp
  800876:	56                   	push   %esi
  800877:	83 ec 04             	sub    $0x4,%esp
  80087a:	ff 75 e4             	pushl  -0x1c(%ebp)
  80087d:	ff 75 e0             	pushl  -0x20(%ebp)
  800880:	ff 75 dc             	pushl  -0x24(%ebp)
  800883:	ff 75 d8             	pushl  -0x28(%ebp)
  800886:	e8 35 1b 00 00       	call   8023c0 <__umoddi3>
  80088b:	83 c4 14             	add    $0x14,%esp
  80088e:	0f be 80 0f 29 80 00 	movsbl 0x80290f(%eax),%eax
  800895:	50                   	push   %eax
  800896:	ff d7                	call   *%edi
}
  800898:	83 c4 10             	add    $0x10,%esp
  80089b:	8d 65 f4             	lea    -0xc(%ebp),%esp
  80089e:	5b                   	pop    %ebx
  80089f:	5e                   	pop    %esi
  8008a0:	5f                   	pop    %edi
  8008a1:	5d                   	pop    %ebp
  8008a2:	c3                   	ret    

008008a3 <sprintputch>:
	int cnt;
};

static void
sprintputch(int ch, struct sprintbuf *b)
{
  8008a3:	f3 0f 1e fb          	endbr32 
  8008a7:	55                   	push   %ebp
  8008a8:	89 e5                	mov    %esp,%ebp
  8008aa:	8b 45 0c             	mov    0xc(%ebp),%eax
	b->cnt++;
  8008ad:	83 40 08 01          	addl   $0x1,0x8(%eax)
	if (b->buf < b->ebuf)
  8008b1:	8b 10                	mov    (%eax),%edx
  8008b3:	3b 50 04             	cmp    0x4(%eax),%edx
  8008b6:	73 0a                	jae    8008c2 <sprintputch+0x1f>
		*b->buf++ = ch;
  8008b8:	8d 4a 01             	lea    0x1(%edx),%ecx
  8008bb:	89 08                	mov    %ecx,(%eax)
  8008bd:	8b 45 08             	mov    0x8(%ebp),%eax
  8008c0:	88 02                	mov    %al,(%edx)
}
  8008c2:	5d                   	pop    %ebp
  8008c3:	c3                   	ret    

008008c4 <printfmt>:
{
  8008c4:	f3 0f 1e fb          	endbr32 
  8008c8:	55                   	push   %ebp
  8008c9:	89 e5                	mov    %esp,%ebp
  8008cb:	83 ec 08             	sub    $0x8,%esp
	va_start(ap, fmt);
  8008ce:	8d 45 14             	lea    0x14(%ebp),%eax
	vprintfmt(putch, putdat, fmt, ap);
  8008d1:	50                   	push   %eax
  8008d2:	ff 75 10             	pushl  0x10(%ebp)
  8008d5:	ff 75 0c             	pushl  0xc(%ebp)
  8008d8:	ff 75 08             	pushl  0x8(%ebp)
  8008db:	e8 05 00 00 00       	call   8008e5 <vprintfmt>
}
  8008e0:	83 c4 10             	add    $0x10,%esp
  8008e3:	c9                   	leave  
  8008e4:	c3                   	ret    

008008e5 <vprintfmt>:
{
  8008e5:	f3 0f 1e fb          	endbr32 
  8008e9:	55                   	push   %ebp
  8008ea:	89 e5                	mov    %esp,%ebp
  8008ec:	57                   	push   %edi
  8008ed:	56                   	push   %esi
  8008ee:	53                   	push   %ebx
  8008ef:	83 ec 3c             	sub    $0x3c,%esp
  8008f2:	8b 75 08             	mov    0x8(%ebp),%esi
  8008f5:	8b 5d 0c             	mov    0xc(%ebp),%ebx
  8008f8:	8b 7d 10             	mov    0x10(%ebp),%edi
  8008fb:	e9 5d 03 00 00       	jmp    800c5d <vprintfmt+0x378>
		padc = ' ';
  800900:	c6 45 d3 20          	movb   $0x20,-0x2d(%ebp)
		altflag = 0;
  800904:	c7 45 e0 00 00 00 00 	movl   $0x0,-0x20(%ebp)
		precision = -1;
  80090b:	c7 45 d8 ff ff ff ff 	movl   $0xffffffff,-0x28(%ebp)
		width = -1;
  800912:	c7 45 d4 ff ff ff ff 	movl   $0xffffffff,-0x2c(%ebp)
		lflag = 0;
  800919:	b9 00 00 00 00       	mov    $0x0,%ecx
		switch (ch = *(unsigned char *) fmt++) {
  80091e:	8d 47 01             	lea    0x1(%edi),%eax
  800921:	89 45 e4             	mov    %eax,-0x1c(%ebp)
  800924:	0f b6 17             	movzbl (%edi),%edx
  800927:	8d 42 dd             	lea    -0x23(%edx),%eax
  80092a:	3c 55                	cmp    $0x55,%al
  80092c:	0f 87 ae 03 00 00    	ja     800ce0 <vprintfmt+0x3fb>
  800932:	0f b6 c0             	movzbl %al,%eax
  800935:	3e ff 24 85 60 2a 80 	notrack jmp *0x802a60(,%eax,4)
  80093c:	00 
  80093d:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			padc = '-';
  800940:	c6 45 d3 2d          	movb   $0x2d,-0x2d(%ebp)
  800944:	eb d8                	jmp    80091e <vprintfmt+0x39>
		switch (ch = *(unsigned char *) fmt++) {
  800946:	8b 7d e4             	mov    -0x1c(%ebp),%edi
  800949:	c6 45 d3 30          	movb   $0x30,-0x2d(%ebp)
  80094d:	eb cf                	jmp    80091e <vprintfmt+0x39>
  80094f:	0f b6 d2             	movzbl %dl,%edx
  800952:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			for (precision = 0; ; ++fmt) {
  800955:	b8 00 00 00 00       	mov    $0x0,%eax
  80095a:	89 4d e4             	mov    %ecx,-0x1c(%ebp)
				precision = precision * 10 + ch - '0';
  80095d:	8d 04 80             	lea    (%eax,%eax,4),%eax
  800960:	8d 44 42 d0          	lea    -0x30(%edx,%eax,2),%eax
				ch = *fmt;
  800964:	0f be 17             	movsbl (%edi),%edx
				if (ch < '0' || ch > '9')
  800967:	8d 4a d0             	lea    -0x30(%edx),%ecx
  80096a:	83 f9 09             	cmp    $0x9,%ecx
  80096d:	77 55                	ja     8009c4 <vprintfmt+0xdf>
			for (precision = 0; ; ++fmt) {
  80096f:	83 c7 01             	add    $0x1,%edi
				precision = precision * 10 + ch - '0';
  800972:	eb e9                	jmp    80095d <vprintfmt+0x78>
			precision = va_arg(ap, int);
  800974:	8b 45 14             	mov    0x14(%ebp),%eax
  800977:	8b 00                	mov    (%eax),%eax
  800979:	89 45 d8             	mov    %eax,-0x28(%ebp)
  80097c:	8b 45 14             	mov    0x14(%ebp),%eax
  80097f:	8d 40 04             	lea    0x4(%eax),%eax
  800982:	89 45 14             	mov    %eax,0x14(%ebp)
		switch (ch = *(unsigned char *) fmt++) {
  800985:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			if (width < 0)
  800988:	83 7d d4 00          	cmpl   $0x0,-0x2c(%ebp)
  80098c:	79 90                	jns    80091e <vprintfmt+0x39>
				width = precision, precision = -1;
  80098e:	8b 45 d8             	mov    -0x28(%ebp),%eax
  800991:	89 45 d4             	mov    %eax,-0x2c(%ebp)
  800994:	c7 45 d8 ff ff ff ff 	movl   $0xffffffff,-0x28(%ebp)
  80099b:	eb 81                	jmp    80091e <vprintfmt+0x39>
  80099d:	8b 45 d4             	mov    -0x2c(%ebp),%eax
  8009a0:	85 c0                	test   %eax,%eax
  8009a2:	ba 00 00 00 00       	mov    $0x0,%edx
  8009a7:	0f 49 d0             	cmovns %eax,%edx
  8009aa:	89 55 d4             	mov    %edx,-0x2c(%ebp)
		switch (ch = *(unsigned char *) fmt++) {
  8009ad:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			goto reswitch;
  8009b0:	e9 69 ff ff ff       	jmp    80091e <vprintfmt+0x39>
		switch (ch = *(unsigned char *) fmt++) {
  8009b5:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			altflag = 1;
  8009b8:	c7 45 e0 01 00 00 00 	movl   $0x1,-0x20(%ebp)
			goto reswitch;
  8009bf:	e9 5a ff ff ff       	jmp    80091e <vprintfmt+0x39>
  8009c4:	8b 4d e4             	mov    -0x1c(%ebp),%ecx
  8009c7:	89 45 d8             	mov    %eax,-0x28(%ebp)
  8009ca:	eb bc                	jmp    800988 <vprintfmt+0xa3>
			lflag++;
  8009cc:	83 c1 01             	add    $0x1,%ecx
		switch (ch = *(unsigned char *) fmt++) {
  8009cf:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			goto reswitch;
  8009d2:	e9 47 ff ff ff       	jmp    80091e <vprintfmt+0x39>
			putch(va_arg(ap, int), putdat);
  8009d7:	8b 45 14             	mov    0x14(%ebp),%eax
  8009da:	8d 78 04             	lea    0x4(%eax),%edi
  8009dd:	83 ec 08             	sub    $0x8,%esp
  8009e0:	53                   	push   %ebx
  8009e1:	ff 30                	pushl  (%eax)
  8009e3:	ff d6                	call   *%esi
			break;
  8009e5:	83 c4 10             	add    $0x10,%esp
			putch(va_arg(ap, int), putdat);
  8009e8:	89 7d 14             	mov    %edi,0x14(%ebp)
			break;
  8009eb:	e9 6a 02 00 00       	jmp    800c5a <vprintfmt+0x375>
			err = va_arg(ap, int);
  8009f0:	8b 45 14             	mov    0x14(%ebp),%eax
  8009f3:	8d 78 04             	lea    0x4(%eax),%edi
  8009f6:	8b 00                	mov    (%eax),%eax
  8009f8:	99                   	cltd   
  8009f9:	31 d0                	xor    %edx,%eax
  8009fb:	29 d0                	sub    %edx,%eax
			if (err >= MAXERROR || (p = error_string[err]) == NULL)
  8009fd:	83 f8 0f             	cmp    $0xf,%eax
  800a00:	7f 23                	jg     800a25 <vprintfmt+0x140>
  800a02:	8b 14 85 c0 2b 80 00 	mov    0x802bc0(,%eax,4),%edx
  800a09:	85 d2                	test   %edx,%edx
  800a0b:	74 18                	je     800a25 <vprintfmt+0x140>
				printfmt(putch, putdat, "%s", p);
  800a0d:	52                   	push   %edx
  800a0e:	68 0d 2d 80 00       	push   $0x802d0d
  800a13:	53                   	push   %ebx
  800a14:	56                   	push   %esi
  800a15:	e8 aa fe ff ff       	call   8008c4 <printfmt>
  800a1a:	83 c4 10             	add    $0x10,%esp
			err = va_arg(ap, int);
  800a1d:	89 7d 14             	mov    %edi,0x14(%ebp)
  800a20:	e9 35 02 00 00       	jmp    800c5a <vprintfmt+0x375>
				printfmt(putch, putdat, "error %d", err);
  800a25:	50                   	push   %eax
  800a26:	68 27 29 80 00       	push   $0x802927
  800a2b:	53                   	push   %ebx
  800a2c:	56                   	push   %esi
  800a2d:	e8 92 fe ff ff       	call   8008c4 <printfmt>
  800a32:	83 c4 10             	add    $0x10,%esp
			err = va_arg(ap, int);
  800a35:	89 7d 14             	mov    %edi,0x14(%ebp)
				printfmt(putch, putdat, "error %d", err);
  800a38:	e9 1d 02 00 00       	jmp    800c5a <vprintfmt+0x375>
			if ((p = va_arg(ap, char *)) == NULL)
  800a3d:	8b 45 14             	mov    0x14(%ebp),%eax
  800a40:	83 c0 04             	add    $0x4,%eax
  800a43:	89 45 c8             	mov    %eax,-0x38(%ebp)
  800a46:	8b 45 14             	mov    0x14(%ebp),%eax
  800a49:	8b 10                	mov    (%eax),%edx
				p = "(null)";
  800a4b:	85 d2                	test   %edx,%edx
  800a4d:	b8 20 29 80 00       	mov    $0x802920,%eax
  800a52:	0f 45 c2             	cmovne %edx,%eax
  800a55:	89 45 cc             	mov    %eax,-0x34(%ebp)
			if (width > 0 && padc != '-')
  800a58:	83 7d d4 00          	cmpl   $0x0,-0x2c(%ebp)
  800a5c:	7e 06                	jle    800a64 <vprintfmt+0x17f>
  800a5e:	80 7d d3 2d          	cmpb   $0x2d,-0x2d(%ebp)
  800a62:	75 0d                	jne    800a71 <vprintfmt+0x18c>
				for (width -= strnlen(p, precision); width > 0; width--)
  800a64:	8b 45 cc             	mov    -0x34(%ebp),%eax
  800a67:	89 c7                	mov    %eax,%edi
  800a69:	03 45 d4             	add    -0x2c(%ebp),%eax
  800a6c:	89 45 d4             	mov    %eax,-0x2c(%ebp)
  800a6f:	eb 55                	jmp    800ac6 <vprintfmt+0x1e1>
  800a71:	83 ec 08             	sub    $0x8,%esp
  800a74:	ff 75 d8             	pushl  -0x28(%ebp)
  800a77:	ff 75 cc             	pushl  -0x34(%ebp)
  800a7a:	e8 15 03 00 00       	call   800d94 <strnlen>
  800a7f:	8b 55 d4             	mov    -0x2c(%ebp),%edx
  800a82:	29 c2                	sub    %eax,%edx
  800a84:	89 55 c4             	mov    %edx,-0x3c(%ebp)
  800a87:	83 c4 10             	add    $0x10,%esp
  800a8a:	89 d7                	mov    %edx,%edi
					putch(padc, putdat);
  800a8c:	0f be 45 d3          	movsbl -0x2d(%ebp),%eax
  800a90:	89 45 d4             	mov    %eax,-0x2c(%ebp)
				for (width -= strnlen(p, precision); width > 0; width--)
  800a93:	85 ff                	test   %edi,%edi
  800a95:	7e 11                	jle    800aa8 <vprintfmt+0x1c3>
					putch(padc, putdat);
  800a97:	83 ec 08             	sub    $0x8,%esp
  800a9a:	53                   	push   %ebx
  800a9b:	ff 75 d4             	pushl  -0x2c(%ebp)
  800a9e:	ff d6                	call   *%esi
				for (width -= strnlen(p, precision); width > 0; width--)
  800aa0:	83 ef 01             	sub    $0x1,%edi
  800aa3:	83 c4 10             	add    $0x10,%esp
  800aa6:	eb eb                	jmp    800a93 <vprintfmt+0x1ae>
  800aa8:	8b 55 c4             	mov    -0x3c(%ebp),%edx
  800aab:	85 d2                	test   %edx,%edx
  800aad:	b8 00 00 00 00       	mov    $0x0,%eax
  800ab2:	0f 49 c2             	cmovns %edx,%eax
  800ab5:	29 c2                	sub    %eax,%edx
  800ab7:	89 55 d4             	mov    %edx,-0x2c(%ebp)
  800aba:	eb a8                	jmp    800a64 <vprintfmt+0x17f>
					putch(ch, putdat);
  800abc:	83 ec 08             	sub    $0x8,%esp
  800abf:	53                   	push   %ebx
  800ac0:	52                   	push   %edx
  800ac1:	ff d6                	call   *%esi
  800ac3:	83 c4 10             	add    $0x10,%esp
  800ac6:	8b 4d d4             	mov    -0x2c(%ebp),%ecx
  800ac9:	29 f9                	sub    %edi,%ecx
			for (; (ch = *p++) != '\0' && (precision < 0 || --precision >= 0); width--)
  800acb:	83 c7 01             	add    $0x1,%edi
  800ace:	0f b6 47 ff          	movzbl -0x1(%edi),%eax
  800ad2:	0f be d0             	movsbl %al,%edx
  800ad5:	85 d2                	test   %edx,%edx
  800ad7:	74 4b                	je     800b24 <vprintfmt+0x23f>
  800ad9:	83 7d d8 00          	cmpl   $0x0,-0x28(%ebp)
  800add:	78 06                	js     800ae5 <vprintfmt+0x200>
  800adf:	83 6d d8 01          	subl   $0x1,-0x28(%ebp)
  800ae3:	78 1e                	js     800b03 <vprintfmt+0x21e>
				if (altflag && (ch < ' ' || ch > '~'))
  800ae5:	83 7d e0 00          	cmpl   $0x0,-0x20(%ebp)
  800ae9:	74 d1                	je     800abc <vprintfmt+0x1d7>
  800aeb:	0f be c0             	movsbl %al,%eax
  800aee:	83 e8 20             	sub    $0x20,%eax
  800af1:	83 f8 5e             	cmp    $0x5e,%eax
  800af4:	76 c6                	jbe    800abc <vprintfmt+0x1d7>
					putch('?', putdat);
  800af6:	83 ec 08             	sub    $0x8,%esp
  800af9:	53                   	push   %ebx
  800afa:	6a 3f                	push   $0x3f
  800afc:	ff d6                	call   *%esi
  800afe:	83 c4 10             	add    $0x10,%esp
  800b01:	eb c3                	jmp    800ac6 <vprintfmt+0x1e1>
  800b03:	89 cf                	mov    %ecx,%edi
  800b05:	eb 0e                	jmp    800b15 <vprintfmt+0x230>
				putch(' ', putdat);
  800b07:	83 ec 08             	sub    $0x8,%esp
  800b0a:	53                   	push   %ebx
  800b0b:	6a 20                	push   $0x20
  800b0d:	ff d6                	call   *%esi
			for (; width > 0; width--)
  800b0f:	83 ef 01             	sub    $0x1,%edi
  800b12:	83 c4 10             	add    $0x10,%esp
  800b15:	85 ff                	test   %edi,%edi
  800b17:	7f ee                	jg     800b07 <vprintfmt+0x222>
			if ((p = va_arg(ap, char *)) == NULL)
  800b19:	8b 45 c8             	mov    -0x38(%ebp),%eax
  800b1c:	89 45 14             	mov    %eax,0x14(%ebp)
  800b1f:	e9 36 01 00 00       	jmp    800c5a <vprintfmt+0x375>
  800b24:	89 cf                	mov    %ecx,%edi
  800b26:	eb ed                	jmp    800b15 <vprintfmt+0x230>
	if (lflag >= 2)
  800b28:	83 f9 01             	cmp    $0x1,%ecx
  800b2b:	7f 1f                	jg     800b4c <vprintfmt+0x267>
	else if (lflag)
  800b2d:	85 c9                	test   %ecx,%ecx
  800b2f:	74 67                	je     800b98 <vprintfmt+0x2b3>
		return va_arg(*ap, long);
  800b31:	8b 45 14             	mov    0x14(%ebp),%eax
  800b34:	8b 00                	mov    (%eax),%eax
  800b36:	89 45 d8             	mov    %eax,-0x28(%ebp)
  800b39:	89 c1                	mov    %eax,%ecx
  800b3b:	c1 f9 1f             	sar    $0x1f,%ecx
  800b3e:	89 4d dc             	mov    %ecx,-0x24(%ebp)
  800b41:	8b 45 14             	mov    0x14(%ebp),%eax
  800b44:	8d 40 04             	lea    0x4(%eax),%eax
  800b47:	89 45 14             	mov    %eax,0x14(%ebp)
  800b4a:	eb 17                	jmp    800b63 <vprintfmt+0x27e>
		return va_arg(*ap, long long);
  800b4c:	8b 45 14             	mov    0x14(%ebp),%eax
  800b4f:	8b 50 04             	mov    0x4(%eax),%edx
  800b52:	8b 00                	mov    (%eax),%eax
  800b54:	89 45 d8             	mov    %eax,-0x28(%ebp)
  800b57:	89 55 dc             	mov    %edx,-0x24(%ebp)
  800b5a:	8b 45 14             	mov    0x14(%ebp),%eax
  800b5d:	8d 40 08             	lea    0x8(%eax),%eax
  800b60:	89 45 14             	mov    %eax,0x14(%ebp)
			if ((long long) num < 0) {
  800b63:	8b 55 d8             	mov    -0x28(%ebp),%edx
  800b66:	8b 4d dc             	mov    -0x24(%ebp),%ecx
			base = 10;
  800b69:	b8 0a 00 00 00       	mov    $0xa,%eax
			if ((long long) num < 0) {
  800b6e:	85 c9                	test   %ecx,%ecx
  800b70:	0f 89 ca 00 00 00    	jns    800c40 <vprintfmt+0x35b>
				putch('-', putdat);
  800b76:	83 ec 08             	sub    $0x8,%esp
  800b79:	53                   	push   %ebx
  800b7a:	6a 2d                	push   $0x2d
  800b7c:	ff d6                	call   *%esi
				num = -(long long) num;
  800b7e:	8b 55 d8             	mov    -0x28(%ebp),%edx
  800b81:	8b 4d dc             	mov    -0x24(%ebp),%ecx
  800b84:	f7 da                	neg    %edx
  800b86:	83 d1 00             	adc    $0x0,%ecx
  800b89:	f7 d9                	neg    %ecx
  800b8b:	83 c4 10             	add    $0x10,%esp
			base = 10;
  800b8e:	b8 0a 00 00 00       	mov    $0xa,%eax
  800b93:	e9 a8 00 00 00       	jmp    800c40 <vprintfmt+0x35b>
		return va_arg(*ap, int);
  800b98:	8b 45 14             	mov    0x14(%ebp),%eax
  800b9b:	8b 00                	mov    (%eax),%eax
  800b9d:	89 45 d8             	mov    %eax,-0x28(%ebp)
  800ba0:	99                   	cltd   
  800ba1:	89 55 dc             	mov    %edx,-0x24(%ebp)
  800ba4:	8b 45 14             	mov    0x14(%ebp),%eax
  800ba7:	8d 40 04             	lea    0x4(%eax),%eax
  800baa:	89 45 14             	mov    %eax,0x14(%ebp)
  800bad:	eb b4                	jmp    800b63 <vprintfmt+0x27e>
	if (lflag >= 2)
  800baf:	83 f9 01             	cmp    $0x1,%ecx
  800bb2:	7f 1b                	jg     800bcf <vprintfmt+0x2ea>
	else if (lflag)
  800bb4:	85 c9                	test   %ecx,%ecx
  800bb6:	74 2c                	je     800be4 <vprintfmt+0x2ff>
		return va_arg(*ap, unsigned long);
  800bb8:	8b 45 14             	mov    0x14(%ebp),%eax
  800bbb:	8b 10                	mov    (%eax),%edx
  800bbd:	b9 00 00 00 00       	mov    $0x0,%ecx
  800bc2:	8d 40 04             	lea    0x4(%eax),%eax
  800bc5:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 10;
  800bc8:	b8 0a 00 00 00       	mov    $0xa,%eax
		return va_arg(*ap, unsigned long);
  800bcd:	eb 71                	jmp    800c40 <vprintfmt+0x35b>
		return va_arg(*ap, unsigned long long);
  800bcf:	8b 45 14             	mov    0x14(%ebp),%eax
  800bd2:	8b 10                	mov    (%eax),%edx
  800bd4:	8b 48 04             	mov    0x4(%eax),%ecx
  800bd7:	8d 40 08             	lea    0x8(%eax),%eax
  800bda:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 10;
  800bdd:	b8 0a 00 00 00       	mov    $0xa,%eax
		return va_arg(*ap, unsigned long long);
  800be2:	eb 5c                	jmp    800c40 <vprintfmt+0x35b>
		return va_arg(*ap, unsigned int);
  800be4:	8b 45 14             	mov    0x14(%ebp),%eax
  800be7:	8b 10                	mov    (%eax),%edx
  800be9:	b9 00 00 00 00       	mov    $0x0,%ecx
  800bee:	8d 40 04             	lea    0x4(%eax),%eax
  800bf1:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 10;
  800bf4:	b8 0a 00 00 00       	mov    $0xa,%eax
		return va_arg(*ap, unsigned int);
  800bf9:	eb 45                	jmp    800c40 <vprintfmt+0x35b>
			putch('X', putdat);
  800bfb:	83 ec 08             	sub    $0x8,%esp
  800bfe:	53                   	push   %ebx
  800bff:	6a 58                	push   $0x58
  800c01:	ff d6                	call   *%esi
			putch('X', putdat);
  800c03:	83 c4 08             	add    $0x8,%esp
  800c06:	53                   	push   %ebx
  800c07:	6a 58                	push   $0x58
  800c09:	ff d6                	call   *%esi
			putch('X', putdat);
  800c0b:	83 c4 08             	add    $0x8,%esp
  800c0e:	53                   	push   %ebx
  800c0f:	6a 58                	push   $0x58
  800c11:	ff d6                	call   *%esi
			break;
  800c13:	83 c4 10             	add    $0x10,%esp
  800c16:	eb 42                	jmp    800c5a <vprintfmt+0x375>
			putch('0', putdat);
  800c18:	83 ec 08             	sub    $0x8,%esp
  800c1b:	53                   	push   %ebx
  800c1c:	6a 30                	push   $0x30
  800c1e:	ff d6                	call   *%esi
			putch('x', putdat);
  800c20:	83 c4 08             	add    $0x8,%esp
  800c23:	53                   	push   %ebx
  800c24:	6a 78                	push   $0x78
  800c26:	ff d6                	call   *%esi
			num = (unsigned long long)
  800c28:	8b 45 14             	mov    0x14(%ebp),%eax
  800c2b:	8b 10                	mov    (%eax),%edx
  800c2d:	b9 00 00 00 00       	mov    $0x0,%ecx
			goto number;
  800c32:	83 c4 10             	add    $0x10,%esp
				(uintptr_t) va_arg(ap, void *);
  800c35:	8d 40 04             	lea    0x4(%eax),%eax
  800c38:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 16;
  800c3b:	b8 10 00 00 00       	mov    $0x10,%eax
			printnum(putch, putdat, num, base, width, padc);
  800c40:	83 ec 0c             	sub    $0xc,%esp
  800c43:	0f be 7d d3          	movsbl -0x2d(%ebp),%edi
  800c47:	57                   	push   %edi
  800c48:	ff 75 d4             	pushl  -0x2c(%ebp)
  800c4b:	50                   	push   %eax
  800c4c:	51                   	push   %ecx
  800c4d:	52                   	push   %edx
  800c4e:	89 da                	mov    %ebx,%edx
  800c50:	89 f0                	mov    %esi,%eax
  800c52:	e8 a3 fb ff ff       	call   8007fa <printnum>
			break;
  800c57:	83 c4 20             	add    $0x20,%esp
			if ((p = va_arg(ap, char *)) == NULL)
  800c5a:	8b 7d e4             	mov    -0x1c(%ebp),%edi
		while ((ch = *(unsigned char *) fmt++) != '%') {
  800c5d:	83 c7 01             	add    $0x1,%edi
  800c60:	0f b6 47 ff          	movzbl -0x1(%edi),%eax
  800c64:	83 f8 25             	cmp    $0x25,%eax
  800c67:	0f 84 93 fc ff ff    	je     800900 <vprintfmt+0x1b>
			if (ch == '\0')
  800c6d:	85 c0                	test   %eax,%eax
  800c6f:	0f 84 8b 00 00 00    	je     800d00 <vprintfmt+0x41b>
			putch(ch, putdat);
  800c75:	83 ec 08             	sub    $0x8,%esp
  800c78:	53                   	push   %ebx
  800c79:	50                   	push   %eax
  800c7a:	ff d6                	call   *%esi
  800c7c:	83 c4 10             	add    $0x10,%esp
  800c7f:	eb dc                	jmp    800c5d <vprintfmt+0x378>
	if (lflag >= 2)
  800c81:	83 f9 01             	cmp    $0x1,%ecx
  800c84:	7f 1b                	jg     800ca1 <vprintfmt+0x3bc>
	else if (lflag)
  800c86:	85 c9                	test   %ecx,%ecx
  800c88:	74 2c                	je     800cb6 <vprintfmt+0x3d1>
		return va_arg(*ap, unsigned long);
  800c8a:	8b 45 14             	mov    0x14(%ebp),%eax
  800c8d:	8b 10                	mov    (%eax),%edx
  800c8f:	b9 00 00 00 00       	mov    $0x0,%ecx
  800c94:	8d 40 04             	lea    0x4(%eax),%eax
  800c97:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 16;
  800c9a:	b8 10 00 00 00       	mov    $0x10,%eax
		return va_arg(*ap, unsigned long);
  800c9f:	eb 9f                	jmp    800c40 <vprintfmt+0x35b>
		return va_arg(*ap, unsigned long long);
  800ca1:	8b 45 14             	mov    0x14(%ebp),%eax
  800ca4:	8b 10                	mov    (%eax),%edx
  800ca6:	8b 48 04             	mov    0x4(%eax),%ecx
  800ca9:	8d 40 08             	lea    0x8(%eax),%eax
  800cac:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 16;
  800caf:	b8 10 00 00 00       	mov    $0x10,%eax
		return va_arg(*ap, unsigned long long);
  800cb4:	eb 8a                	jmp    800c40 <vprintfmt+0x35b>
		return va_arg(*ap, unsigned int);
  800cb6:	8b 45 14             	mov    0x14(%ebp),%eax
  800cb9:	8b 10                	mov    (%eax),%edx
  800cbb:	b9 00 00 00 00       	mov    $0x0,%ecx
  800cc0:	8d 40 04             	lea    0x4(%eax),%eax
  800cc3:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 16;
  800cc6:	b8 10 00 00 00       	mov    $0x10,%eax
		return va_arg(*ap, unsigned int);
  800ccb:	e9 70 ff ff ff       	jmp    800c40 <vprintfmt+0x35b>
			putch(ch, putdat);
  800cd0:	83 ec 08             	sub    $0x8,%esp
  800cd3:	53                   	push   %ebx
  800cd4:	6a 25                	push   $0x25
  800cd6:	ff d6                	call   *%esi
			break;
  800cd8:	83 c4 10             	add    $0x10,%esp
  800cdb:	e9 7a ff ff ff       	jmp    800c5a <vprintfmt+0x375>
			putch('%', putdat);
  800ce0:	83 ec 08             	sub    $0x8,%esp
  800ce3:	53                   	push   %ebx
  800ce4:	6a 25                	push   $0x25
  800ce6:	ff d6                	call   *%esi
			for (fmt--; fmt[-1] != '%'; fmt--)
  800ce8:	83 c4 10             	add    $0x10,%esp
  800ceb:	89 f8                	mov    %edi,%eax
  800ced:	80 78 ff 25          	cmpb   $0x25,-0x1(%eax)
  800cf1:	74 05                	je     800cf8 <vprintfmt+0x413>
  800cf3:	83 e8 01             	sub    $0x1,%eax
  800cf6:	eb f5                	jmp    800ced <vprintfmt+0x408>
  800cf8:	89 45 e4             	mov    %eax,-0x1c(%ebp)
  800cfb:	e9 5a ff ff ff       	jmp    800c5a <vprintfmt+0x375>
}
  800d00:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800d03:	5b                   	pop    %ebx
  800d04:	5e                   	pop    %esi
  800d05:	5f                   	pop    %edi
  800d06:	5d                   	pop    %ebp
  800d07:	c3                   	ret    

00800d08 <vsnprintf>:

int
vsnprintf(char *buf, int n, const char *fmt, va_list ap)
{
  800d08:	f3 0f 1e fb          	endbr32 
  800d0c:	55                   	push   %ebp
  800d0d:	89 e5                	mov    %esp,%ebp
  800d0f:	83 ec 18             	sub    $0x18,%esp
  800d12:	8b 45 08             	mov    0x8(%ebp),%eax
  800d15:	8b 55 0c             	mov    0xc(%ebp),%edx
	struct sprintbuf b = {buf, buf+n-1, 0};
  800d18:	89 45 ec             	mov    %eax,-0x14(%ebp)
  800d1b:	8d 4c 10 ff          	lea    -0x1(%eax,%edx,1),%ecx
  800d1f:	89 4d f0             	mov    %ecx,-0x10(%ebp)
  800d22:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)

	if (buf == NULL || n < 1)
  800d29:	85 c0                	test   %eax,%eax
  800d2b:	74 26                	je     800d53 <vsnprintf+0x4b>
  800d2d:	85 d2                	test   %edx,%edx
  800d2f:	7e 22                	jle    800d53 <vsnprintf+0x4b>
		return -E_INVAL;

	// print the string to the buffer
	vprintfmt((void*)sprintputch, &b, fmt, ap);
  800d31:	ff 75 14             	pushl  0x14(%ebp)
  800d34:	ff 75 10             	pushl  0x10(%ebp)
  800d37:	8d 45 ec             	lea    -0x14(%ebp),%eax
  800d3a:	50                   	push   %eax
  800d3b:	68 a3 08 80 00       	push   $0x8008a3
  800d40:	e8 a0 fb ff ff       	call   8008e5 <vprintfmt>

	// null terminate the buffer
	*b.buf = '\0';
  800d45:	8b 45 ec             	mov    -0x14(%ebp),%eax
  800d48:	c6 00 00             	movb   $0x0,(%eax)

	return b.cnt;
  800d4b:	8b 45 f4             	mov    -0xc(%ebp),%eax
  800d4e:	83 c4 10             	add    $0x10,%esp
}
  800d51:	c9                   	leave  
  800d52:	c3                   	ret    
		return -E_INVAL;
  800d53:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  800d58:	eb f7                	jmp    800d51 <vsnprintf+0x49>

00800d5a <snprintf>:

int
snprintf(char *buf, int n, const char *fmt, ...)
{
  800d5a:	f3 0f 1e fb          	endbr32 
  800d5e:	55                   	push   %ebp
  800d5f:	89 e5                	mov    %esp,%ebp
  800d61:	83 ec 08             	sub    $0x8,%esp
	va_list ap;
	int rc;

	va_start(ap, fmt);
  800d64:	8d 45 14             	lea    0x14(%ebp),%eax
	rc = vsnprintf(buf, n, fmt, ap);
  800d67:	50                   	push   %eax
  800d68:	ff 75 10             	pushl  0x10(%ebp)
  800d6b:	ff 75 0c             	pushl  0xc(%ebp)
  800d6e:	ff 75 08             	pushl  0x8(%ebp)
  800d71:	e8 92 ff ff ff       	call   800d08 <vsnprintf>
	va_end(ap);

	return rc;
}
  800d76:	c9                   	leave  
  800d77:	c3                   	ret    

00800d78 <strlen>:
// Primespipe runs 3x faster this way.
#define ASM 1

int
strlen(const char *s)
{
  800d78:	f3 0f 1e fb          	endbr32 
  800d7c:	55                   	push   %ebp
  800d7d:	89 e5                	mov    %esp,%ebp
  800d7f:	8b 55 08             	mov    0x8(%ebp),%edx
	int n;

	for (n = 0; *s != '\0'; s++)
  800d82:	b8 00 00 00 00       	mov    $0x0,%eax
  800d87:	80 3c 02 00          	cmpb   $0x0,(%edx,%eax,1)
  800d8b:	74 05                	je     800d92 <strlen+0x1a>
		n++;
  800d8d:	83 c0 01             	add    $0x1,%eax
  800d90:	eb f5                	jmp    800d87 <strlen+0xf>
	return n;
}
  800d92:	5d                   	pop    %ebp
  800d93:	c3                   	ret    

00800d94 <strnlen>:

int
strnlen(const char *s, size_t size)
{
  800d94:	f3 0f 1e fb          	endbr32 
  800d98:	55                   	push   %ebp
  800d99:	89 e5                	mov    %esp,%ebp
  800d9b:	8b 4d 08             	mov    0x8(%ebp),%ecx
  800d9e:	8b 55 0c             	mov    0xc(%ebp),%edx
	int n;

	for (n = 0; size > 0 && *s != '\0'; s++, size--)
  800da1:	b8 00 00 00 00       	mov    $0x0,%eax
  800da6:	39 d0                	cmp    %edx,%eax
  800da8:	74 0d                	je     800db7 <strnlen+0x23>
  800daa:	80 3c 01 00          	cmpb   $0x0,(%ecx,%eax,1)
  800dae:	74 05                	je     800db5 <strnlen+0x21>
		n++;
  800db0:	83 c0 01             	add    $0x1,%eax
  800db3:	eb f1                	jmp    800da6 <strnlen+0x12>
  800db5:	89 c2                	mov    %eax,%edx
	return n;
}
  800db7:	89 d0                	mov    %edx,%eax
  800db9:	5d                   	pop    %ebp
  800dba:	c3                   	ret    

00800dbb <strcpy>:

char *
strcpy(char *dst, const char *src)
{
  800dbb:	f3 0f 1e fb          	endbr32 
  800dbf:	55                   	push   %ebp
  800dc0:	89 e5                	mov    %esp,%ebp
  800dc2:	53                   	push   %ebx
  800dc3:	8b 4d 08             	mov    0x8(%ebp),%ecx
  800dc6:	8b 5d 0c             	mov    0xc(%ebp),%ebx
	char *ret;

	ret = dst;
	while ((*dst++ = *src++) != '\0')
  800dc9:	b8 00 00 00 00       	mov    $0x0,%eax
  800dce:	0f b6 14 03          	movzbl (%ebx,%eax,1),%edx
  800dd2:	88 14 01             	mov    %dl,(%ecx,%eax,1)
  800dd5:	83 c0 01             	add    $0x1,%eax
  800dd8:	84 d2                	test   %dl,%dl
  800dda:	75 f2                	jne    800dce <strcpy+0x13>
		/* do nothing */;
	return ret;
}
  800ddc:	89 c8                	mov    %ecx,%eax
  800dde:	5b                   	pop    %ebx
  800ddf:	5d                   	pop    %ebp
  800de0:	c3                   	ret    

00800de1 <strcat>:

char *
strcat(char *dst, const char *src)
{
  800de1:	f3 0f 1e fb          	endbr32 
  800de5:	55                   	push   %ebp
  800de6:	89 e5                	mov    %esp,%ebp
  800de8:	53                   	push   %ebx
  800de9:	83 ec 10             	sub    $0x10,%esp
  800dec:	8b 5d 08             	mov    0x8(%ebp),%ebx
	int len = strlen(dst);
  800def:	53                   	push   %ebx
  800df0:	e8 83 ff ff ff       	call   800d78 <strlen>
  800df5:	83 c4 08             	add    $0x8,%esp
	strcpy(dst + len, src);
  800df8:	ff 75 0c             	pushl  0xc(%ebp)
  800dfb:	01 d8                	add    %ebx,%eax
  800dfd:	50                   	push   %eax
  800dfe:	e8 b8 ff ff ff       	call   800dbb <strcpy>
	return dst;
}
  800e03:	89 d8                	mov    %ebx,%eax
  800e05:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  800e08:	c9                   	leave  
  800e09:	c3                   	ret    

00800e0a <strncpy>:

char *
strncpy(char *dst, const char *src, size_t size) {
  800e0a:	f3 0f 1e fb          	endbr32 
  800e0e:	55                   	push   %ebp
  800e0f:	89 e5                	mov    %esp,%ebp
  800e11:	56                   	push   %esi
  800e12:	53                   	push   %ebx
  800e13:	8b 75 08             	mov    0x8(%ebp),%esi
  800e16:	8b 55 0c             	mov    0xc(%ebp),%edx
  800e19:	89 f3                	mov    %esi,%ebx
  800e1b:	03 5d 10             	add    0x10(%ebp),%ebx
	size_t i;
	char *ret;

	ret = dst;
	for (i = 0; i < size; i++) {
  800e1e:	89 f0                	mov    %esi,%eax
  800e20:	39 d8                	cmp    %ebx,%eax
  800e22:	74 11                	je     800e35 <strncpy+0x2b>
		*dst++ = *src;
  800e24:	83 c0 01             	add    $0x1,%eax
  800e27:	0f b6 0a             	movzbl (%edx),%ecx
  800e2a:	88 48 ff             	mov    %cl,-0x1(%eax)
		// If strlen(src) < size, null-pad 'dst' out to 'size' chars
		if (*src != '\0')
			src++;
  800e2d:	80 f9 01             	cmp    $0x1,%cl
  800e30:	83 da ff             	sbb    $0xffffffff,%edx
  800e33:	eb eb                	jmp    800e20 <strncpy+0x16>
	}
	return ret;
}
  800e35:	89 f0                	mov    %esi,%eax
  800e37:	5b                   	pop    %ebx
  800e38:	5e                   	pop    %esi
  800e39:	5d                   	pop    %ebp
  800e3a:	c3                   	ret    

00800e3b <strlcpy>:

size_t
strlcpy(char *dst, const char *src, size_t size)
{
  800e3b:	f3 0f 1e fb          	endbr32 
  800e3f:	55                   	push   %ebp
  800e40:	89 e5                	mov    %esp,%ebp
  800e42:	56                   	push   %esi
  800e43:	53                   	push   %ebx
  800e44:	8b 75 08             	mov    0x8(%ebp),%esi
  800e47:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800e4a:	8b 55 10             	mov    0x10(%ebp),%edx
  800e4d:	89 f0                	mov    %esi,%eax
	char *dst_in;

	dst_in = dst;
	if (size > 0) {
  800e4f:	85 d2                	test   %edx,%edx
  800e51:	74 21                	je     800e74 <strlcpy+0x39>
  800e53:	8d 44 16 ff          	lea    -0x1(%esi,%edx,1),%eax
  800e57:	89 f2                	mov    %esi,%edx
		while (--size > 0 && *src != '\0')
  800e59:	39 c2                	cmp    %eax,%edx
  800e5b:	74 14                	je     800e71 <strlcpy+0x36>
  800e5d:	0f b6 19             	movzbl (%ecx),%ebx
  800e60:	84 db                	test   %bl,%bl
  800e62:	74 0b                	je     800e6f <strlcpy+0x34>
			*dst++ = *src++;
  800e64:	83 c1 01             	add    $0x1,%ecx
  800e67:	83 c2 01             	add    $0x1,%edx
  800e6a:	88 5a ff             	mov    %bl,-0x1(%edx)
  800e6d:	eb ea                	jmp    800e59 <strlcpy+0x1e>
  800e6f:	89 d0                	mov    %edx,%eax
		*dst = '\0';
  800e71:	c6 00 00             	movb   $0x0,(%eax)
	}
	return dst - dst_in;
  800e74:	29 f0                	sub    %esi,%eax
}
  800e76:	5b                   	pop    %ebx
  800e77:	5e                   	pop    %esi
  800e78:	5d                   	pop    %ebp
  800e79:	c3                   	ret    

00800e7a <strcmp>:

int
strcmp(const char *p, const char *q)
{
  800e7a:	f3 0f 1e fb          	endbr32 
  800e7e:	55                   	push   %ebp
  800e7f:	89 e5                	mov    %esp,%ebp
  800e81:	8b 4d 08             	mov    0x8(%ebp),%ecx
  800e84:	8b 55 0c             	mov    0xc(%ebp),%edx
	while (*p && *p == *q)
  800e87:	0f b6 01             	movzbl (%ecx),%eax
  800e8a:	84 c0                	test   %al,%al
  800e8c:	74 0c                	je     800e9a <strcmp+0x20>
  800e8e:	3a 02                	cmp    (%edx),%al
  800e90:	75 08                	jne    800e9a <strcmp+0x20>
		p++, q++;
  800e92:	83 c1 01             	add    $0x1,%ecx
  800e95:	83 c2 01             	add    $0x1,%edx
  800e98:	eb ed                	jmp    800e87 <strcmp+0xd>
	return (int) ((unsigned char) *p - (unsigned char) *q);
  800e9a:	0f b6 c0             	movzbl %al,%eax
  800e9d:	0f b6 12             	movzbl (%edx),%edx
  800ea0:	29 d0                	sub    %edx,%eax
}
  800ea2:	5d                   	pop    %ebp
  800ea3:	c3                   	ret    

00800ea4 <strncmp>:

int
strncmp(const char *p, const char *q, size_t n)
{
  800ea4:	f3 0f 1e fb          	endbr32 
  800ea8:	55                   	push   %ebp
  800ea9:	89 e5                	mov    %esp,%ebp
  800eab:	53                   	push   %ebx
  800eac:	8b 45 08             	mov    0x8(%ebp),%eax
  800eaf:	8b 55 0c             	mov    0xc(%ebp),%edx
  800eb2:	89 c3                	mov    %eax,%ebx
  800eb4:	03 5d 10             	add    0x10(%ebp),%ebx
	while (n > 0 && *p && *p == *q)
  800eb7:	eb 06                	jmp    800ebf <strncmp+0x1b>
		n--, p++, q++;
  800eb9:	83 c0 01             	add    $0x1,%eax
  800ebc:	83 c2 01             	add    $0x1,%edx
	while (n > 0 && *p && *p == *q)
  800ebf:	39 d8                	cmp    %ebx,%eax
  800ec1:	74 16                	je     800ed9 <strncmp+0x35>
  800ec3:	0f b6 08             	movzbl (%eax),%ecx
  800ec6:	84 c9                	test   %cl,%cl
  800ec8:	74 04                	je     800ece <strncmp+0x2a>
  800eca:	3a 0a                	cmp    (%edx),%cl
  800ecc:	74 eb                	je     800eb9 <strncmp+0x15>
	if (n == 0)
		return 0;
	else
		return (int) ((unsigned char) *p - (unsigned char) *q);
  800ece:	0f b6 00             	movzbl (%eax),%eax
  800ed1:	0f b6 12             	movzbl (%edx),%edx
  800ed4:	29 d0                	sub    %edx,%eax
}
  800ed6:	5b                   	pop    %ebx
  800ed7:	5d                   	pop    %ebp
  800ed8:	c3                   	ret    
		return 0;
  800ed9:	b8 00 00 00 00       	mov    $0x0,%eax
  800ede:	eb f6                	jmp    800ed6 <strncmp+0x32>

00800ee0 <strchr>:

// Return a pointer to the first occurrence of 'c' in 's',
// or a null pointer if the string has no 'c'.
char *
strchr(const char *s, char c)
{
  800ee0:	f3 0f 1e fb          	endbr32 
  800ee4:	55                   	push   %ebp
  800ee5:	89 e5                	mov    %esp,%ebp
  800ee7:	8b 45 08             	mov    0x8(%ebp),%eax
  800eea:	0f b6 4d 0c          	movzbl 0xc(%ebp),%ecx
	for (; *s; s++)
  800eee:	0f b6 10             	movzbl (%eax),%edx
  800ef1:	84 d2                	test   %dl,%dl
  800ef3:	74 09                	je     800efe <strchr+0x1e>
		if (*s == c)
  800ef5:	38 ca                	cmp    %cl,%dl
  800ef7:	74 0a                	je     800f03 <strchr+0x23>
	for (; *s; s++)
  800ef9:	83 c0 01             	add    $0x1,%eax
  800efc:	eb f0                	jmp    800eee <strchr+0xe>
			return (char *) s;
	return 0;
  800efe:	b8 00 00 00 00       	mov    $0x0,%eax
}
  800f03:	5d                   	pop    %ebp
  800f04:	c3                   	ret    

00800f05 <strfind>:

// Return a pointer to the first occurrence of 'c' in 's',
// or a pointer to the string-ending null character if the string has no 'c'.
char *
strfind(const char *s, char c)
{
  800f05:	f3 0f 1e fb          	endbr32 
  800f09:	55                   	push   %ebp
  800f0a:	89 e5                	mov    %esp,%ebp
  800f0c:	8b 45 08             	mov    0x8(%ebp),%eax
  800f0f:	0f b6 4d 0c          	movzbl 0xc(%ebp),%ecx
	for (; *s; s++)
  800f13:	0f b6 10             	movzbl (%eax),%edx
		if (*s == c)
  800f16:	38 ca                	cmp    %cl,%dl
  800f18:	74 09                	je     800f23 <strfind+0x1e>
  800f1a:	84 d2                	test   %dl,%dl
  800f1c:	74 05                	je     800f23 <strfind+0x1e>
	for (; *s; s++)
  800f1e:	83 c0 01             	add    $0x1,%eax
  800f21:	eb f0                	jmp    800f13 <strfind+0xe>
			break;
	return (char *) s;
}
  800f23:	5d                   	pop    %ebp
  800f24:	c3                   	ret    

00800f25 <memset>:

#if ASM
void *
memset(void *v, int c, size_t n)
{
  800f25:	f3 0f 1e fb          	endbr32 
  800f29:	55                   	push   %ebp
  800f2a:	89 e5                	mov    %esp,%ebp
  800f2c:	57                   	push   %edi
  800f2d:	56                   	push   %esi
  800f2e:	53                   	push   %ebx
  800f2f:	8b 7d 08             	mov    0x8(%ebp),%edi
  800f32:	8b 4d 10             	mov    0x10(%ebp),%ecx
	char *p;

	if (n == 0)
  800f35:	85 c9                	test   %ecx,%ecx
  800f37:	74 31                	je     800f6a <memset+0x45>
		return v;
	if ((int)v%4 == 0 && n%4 == 0) {
  800f39:	89 f8                	mov    %edi,%eax
  800f3b:	09 c8                	or     %ecx,%eax
  800f3d:	a8 03                	test   $0x3,%al
  800f3f:	75 23                	jne    800f64 <memset+0x3f>
		c &= 0xFF;
  800f41:	0f b6 55 0c          	movzbl 0xc(%ebp),%edx
		c = (c<<24)|(c<<16)|(c<<8)|c;
  800f45:	89 d3                	mov    %edx,%ebx
  800f47:	c1 e3 08             	shl    $0x8,%ebx
  800f4a:	89 d0                	mov    %edx,%eax
  800f4c:	c1 e0 18             	shl    $0x18,%eax
  800f4f:	89 d6                	mov    %edx,%esi
  800f51:	c1 e6 10             	shl    $0x10,%esi
  800f54:	09 f0                	or     %esi,%eax
  800f56:	09 c2                	or     %eax,%edx
  800f58:	09 da                	or     %ebx,%edx
		asm volatile("cld; rep stosl\n"
			:: "D" (v), "a" (c), "c" (n/4)
  800f5a:	c1 e9 02             	shr    $0x2,%ecx
		asm volatile("cld; rep stosl\n"
  800f5d:	89 d0                	mov    %edx,%eax
  800f5f:	fc                   	cld    
  800f60:	f3 ab                	rep stos %eax,%es:(%edi)
  800f62:	eb 06                	jmp    800f6a <memset+0x45>
			: "cc", "memory");
	} else
		asm volatile("cld; rep stosb\n"
  800f64:	8b 45 0c             	mov    0xc(%ebp),%eax
  800f67:	fc                   	cld    
  800f68:	f3 aa                	rep stos %al,%es:(%edi)
			:: "D" (v), "a" (c), "c" (n)
			: "cc", "memory");
	return v;
}
  800f6a:	89 f8                	mov    %edi,%eax
  800f6c:	5b                   	pop    %ebx
  800f6d:	5e                   	pop    %esi
  800f6e:	5f                   	pop    %edi
  800f6f:	5d                   	pop    %ebp
  800f70:	c3                   	ret    

00800f71 <memmove>:

void *
memmove(void *dst, const void *src, size_t n)
{
  800f71:	f3 0f 1e fb          	endbr32 
  800f75:	55                   	push   %ebp
  800f76:	89 e5                	mov    %esp,%ebp
  800f78:	57                   	push   %edi
  800f79:	56                   	push   %esi
  800f7a:	8b 45 08             	mov    0x8(%ebp),%eax
  800f7d:	8b 75 0c             	mov    0xc(%ebp),%esi
  800f80:	8b 4d 10             	mov    0x10(%ebp),%ecx
	const char *s;
	char *d;

	s = src;
	d = dst;
	if (s < d && s + n > d) {
  800f83:	39 c6                	cmp    %eax,%esi
  800f85:	73 32                	jae    800fb9 <memmove+0x48>
  800f87:	8d 14 0e             	lea    (%esi,%ecx,1),%edx
  800f8a:	39 c2                	cmp    %eax,%edx
  800f8c:	76 2b                	jbe    800fb9 <memmove+0x48>
		s += n;
		d += n;
  800f8e:	8d 3c 08             	lea    (%eax,%ecx,1),%edi
		if ((int)s%4 == 0 && (int)d%4 == 0 && n%4 == 0)
  800f91:	89 fe                	mov    %edi,%esi
  800f93:	09 ce                	or     %ecx,%esi
  800f95:	09 d6                	or     %edx,%esi
  800f97:	f7 c6 03 00 00 00    	test   $0x3,%esi
  800f9d:	75 0e                	jne    800fad <memmove+0x3c>
			asm volatile("std; rep movsl\n"
				:: "D" (d-4), "S" (s-4), "c" (n/4) : "cc", "memory");
  800f9f:	83 ef 04             	sub    $0x4,%edi
  800fa2:	8d 72 fc             	lea    -0x4(%edx),%esi
  800fa5:	c1 e9 02             	shr    $0x2,%ecx
			asm volatile("std; rep movsl\n"
  800fa8:	fd                   	std    
  800fa9:	f3 a5                	rep movsl %ds:(%esi),%es:(%edi)
  800fab:	eb 09                	jmp    800fb6 <memmove+0x45>
		else
			asm volatile("std; rep movsb\n"
				:: "D" (d-1), "S" (s-1), "c" (n) : "cc", "memory");
  800fad:	83 ef 01             	sub    $0x1,%edi
  800fb0:	8d 72 ff             	lea    -0x1(%edx),%esi
			asm volatile("std; rep movsb\n"
  800fb3:	fd                   	std    
  800fb4:	f3 a4                	rep movsb %ds:(%esi),%es:(%edi)
		// Some versions of GCC rely on DF being clear
		asm volatile("cld" ::: "cc");
  800fb6:	fc                   	cld    
  800fb7:	eb 1a                	jmp    800fd3 <memmove+0x62>
	} else {
		if ((int)s%4 == 0 && (int)d%4 == 0 && n%4 == 0)
  800fb9:	89 c2                	mov    %eax,%edx
  800fbb:	09 ca                	or     %ecx,%edx
  800fbd:	09 f2                	or     %esi,%edx
  800fbf:	f6 c2 03             	test   $0x3,%dl
  800fc2:	75 0a                	jne    800fce <memmove+0x5d>
			asm volatile("cld; rep movsl\n"
				:: "D" (d), "S" (s), "c" (n/4) : "cc", "memory");
  800fc4:	c1 e9 02             	shr    $0x2,%ecx
			asm volatile("cld; rep movsl\n"
  800fc7:	89 c7                	mov    %eax,%edi
  800fc9:	fc                   	cld    
  800fca:	f3 a5                	rep movsl %ds:(%esi),%es:(%edi)
  800fcc:	eb 05                	jmp    800fd3 <memmove+0x62>
		else
			asm volatile("cld; rep movsb\n"
  800fce:	89 c7                	mov    %eax,%edi
  800fd0:	fc                   	cld    
  800fd1:	f3 a4                	rep movsb %ds:(%esi),%es:(%edi)
				:: "D" (d), "S" (s), "c" (n) : "cc", "memory");
	}
	return dst;
}
  800fd3:	5e                   	pop    %esi
  800fd4:	5f                   	pop    %edi
  800fd5:	5d                   	pop    %ebp
  800fd6:	c3                   	ret    

00800fd7 <memcpy>:
}
#endif

void *
memcpy(void *dst, const void *src, size_t n)
{
  800fd7:	f3 0f 1e fb          	endbr32 
  800fdb:	55                   	push   %ebp
  800fdc:	89 e5                	mov    %esp,%ebp
  800fde:	83 ec 0c             	sub    $0xc,%esp
	return memmove(dst, src, n);
  800fe1:	ff 75 10             	pushl  0x10(%ebp)
  800fe4:	ff 75 0c             	pushl  0xc(%ebp)
  800fe7:	ff 75 08             	pushl  0x8(%ebp)
  800fea:	e8 82 ff ff ff       	call   800f71 <memmove>
}
  800fef:	c9                   	leave  
  800ff0:	c3                   	ret    

00800ff1 <memcmp>:

int
memcmp(const void *v1, const void *v2, size_t n)
{
  800ff1:	f3 0f 1e fb          	endbr32 
  800ff5:	55                   	push   %ebp
  800ff6:	89 e5                	mov    %esp,%ebp
  800ff8:	56                   	push   %esi
  800ff9:	53                   	push   %ebx
  800ffa:	8b 45 08             	mov    0x8(%ebp),%eax
  800ffd:	8b 55 0c             	mov    0xc(%ebp),%edx
  801000:	89 c6                	mov    %eax,%esi
  801002:	03 75 10             	add    0x10(%ebp),%esi
	const uint8_t *s1 = (const uint8_t *) v1;
	const uint8_t *s2 = (const uint8_t *) v2;

	while (n-- > 0) {
  801005:	39 f0                	cmp    %esi,%eax
  801007:	74 1c                	je     801025 <memcmp+0x34>
		if (*s1 != *s2)
  801009:	0f b6 08             	movzbl (%eax),%ecx
  80100c:	0f b6 1a             	movzbl (%edx),%ebx
  80100f:	38 d9                	cmp    %bl,%cl
  801011:	75 08                	jne    80101b <memcmp+0x2a>
			return (int) *s1 - (int) *s2;
		s1++, s2++;
  801013:	83 c0 01             	add    $0x1,%eax
  801016:	83 c2 01             	add    $0x1,%edx
  801019:	eb ea                	jmp    801005 <memcmp+0x14>
			return (int) *s1 - (int) *s2;
  80101b:	0f b6 c1             	movzbl %cl,%eax
  80101e:	0f b6 db             	movzbl %bl,%ebx
  801021:	29 d8                	sub    %ebx,%eax
  801023:	eb 05                	jmp    80102a <memcmp+0x39>
	}

	return 0;
  801025:	b8 00 00 00 00       	mov    $0x0,%eax
}
  80102a:	5b                   	pop    %ebx
  80102b:	5e                   	pop    %esi
  80102c:	5d                   	pop    %ebp
  80102d:	c3                   	ret    

0080102e <memfind>:

void *
memfind(const void *s, int c, size_t n)
{
  80102e:	f3 0f 1e fb          	endbr32 
  801032:	55                   	push   %ebp
  801033:	89 e5                	mov    %esp,%ebp
  801035:	8b 45 08             	mov    0x8(%ebp),%eax
  801038:	8b 4d 0c             	mov    0xc(%ebp),%ecx
	const void *ends = (const char *) s + n;
  80103b:	89 c2                	mov    %eax,%edx
  80103d:	03 55 10             	add    0x10(%ebp),%edx
	for (; s < ends; s++)
  801040:	39 d0                	cmp    %edx,%eax
  801042:	73 09                	jae    80104d <memfind+0x1f>
		if (*(const unsigned char *) s == (unsigned char) c)
  801044:	38 08                	cmp    %cl,(%eax)
  801046:	74 05                	je     80104d <memfind+0x1f>
	for (; s < ends; s++)
  801048:	83 c0 01             	add    $0x1,%eax
  80104b:	eb f3                	jmp    801040 <memfind+0x12>
			break;
	return (void *) s;
}
  80104d:	5d                   	pop    %ebp
  80104e:	c3                   	ret    

0080104f <strtol>:

long
strtol(const char *s, char **endptr, int base)
{
  80104f:	f3 0f 1e fb          	endbr32 
  801053:	55                   	push   %ebp
  801054:	89 e5                	mov    %esp,%ebp
  801056:	57                   	push   %edi
  801057:	56                   	push   %esi
  801058:	53                   	push   %ebx
  801059:	8b 4d 08             	mov    0x8(%ebp),%ecx
  80105c:	8b 5d 10             	mov    0x10(%ebp),%ebx
	int neg = 0;
	long val = 0;

	// gobble initial whitespace
	while (*s == ' ' || *s == '\t')
  80105f:	eb 03                	jmp    801064 <strtol+0x15>
		s++;
  801061:	83 c1 01             	add    $0x1,%ecx
	while (*s == ' ' || *s == '\t')
  801064:	0f b6 01             	movzbl (%ecx),%eax
  801067:	3c 20                	cmp    $0x20,%al
  801069:	74 f6                	je     801061 <strtol+0x12>
  80106b:	3c 09                	cmp    $0x9,%al
  80106d:	74 f2                	je     801061 <strtol+0x12>

	// plus/minus sign
	if (*s == '+')
  80106f:	3c 2b                	cmp    $0x2b,%al
  801071:	74 2a                	je     80109d <strtol+0x4e>
	int neg = 0;
  801073:	bf 00 00 00 00       	mov    $0x0,%edi
		s++;
	else if (*s == '-')
  801078:	3c 2d                	cmp    $0x2d,%al
  80107a:	74 2b                	je     8010a7 <strtol+0x58>
		s++, neg = 1;

	// hex or octal base prefix
	if ((base == 0 || base == 16) && (s[0] == '0' && s[1] == 'x'))
  80107c:	f7 c3 ef ff ff ff    	test   $0xffffffef,%ebx
  801082:	75 0f                	jne    801093 <strtol+0x44>
  801084:	80 39 30             	cmpb   $0x30,(%ecx)
  801087:	74 28                	je     8010b1 <strtol+0x62>
		s += 2, base = 16;
	else if (base == 0 && s[0] == '0')
		s++, base = 8;
	else if (base == 0)
		base = 10;
  801089:	85 db                	test   %ebx,%ebx
  80108b:	b8 0a 00 00 00       	mov    $0xa,%eax
  801090:	0f 44 d8             	cmove  %eax,%ebx
  801093:	b8 00 00 00 00       	mov    $0x0,%eax
  801098:	89 5d 10             	mov    %ebx,0x10(%ebp)
  80109b:	eb 46                	jmp    8010e3 <strtol+0x94>
		s++;
  80109d:	83 c1 01             	add    $0x1,%ecx
	int neg = 0;
  8010a0:	bf 00 00 00 00       	mov    $0x0,%edi
  8010a5:	eb d5                	jmp    80107c <strtol+0x2d>
		s++, neg = 1;
  8010a7:	83 c1 01             	add    $0x1,%ecx
  8010aa:	bf 01 00 00 00       	mov    $0x1,%edi
  8010af:	eb cb                	jmp    80107c <strtol+0x2d>
	if ((base == 0 || base == 16) && (s[0] == '0' && s[1] == 'x'))
  8010b1:	80 79 01 78          	cmpb   $0x78,0x1(%ecx)
  8010b5:	74 0e                	je     8010c5 <strtol+0x76>
	else if (base == 0 && s[0] == '0')
  8010b7:	85 db                	test   %ebx,%ebx
  8010b9:	75 d8                	jne    801093 <strtol+0x44>
		s++, base = 8;
  8010bb:	83 c1 01             	add    $0x1,%ecx
  8010be:	bb 08 00 00 00       	mov    $0x8,%ebx
  8010c3:	eb ce                	jmp    801093 <strtol+0x44>
		s += 2, base = 16;
  8010c5:	83 c1 02             	add    $0x2,%ecx
  8010c8:	bb 10 00 00 00       	mov    $0x10,%ebx
  8010cd:	eb c4                	jmp    801093 <strtol+0x44>
	// digits
	while (1) {
		int dig;

		if (*s >= '0' && *s <= '9')
			dig = *s - '0';
  8010cf:	0f be d2             	movsbl %dl,%edx
  8010d2:	83 ea 30             	sub    $0x30,%edx
			dig = *s - 'a' + 10;
		else if (*s >= 'A' && *s <= 'Z')
			dig = *s - 'A' + 10;
		else
			break;
		if (dig >= base)
  8010d5:	3b 55 10             	cmp    0x10(%ebp),%edx
  8010d8:	7d 3a                	jge    801114 <strtol+0xc5>
			break;
		s++, val = (val * base) + dig;
  8010da:	83 c1 01             	add    $0x1,%ecx
  8010dd:	0f af 45 10          	imul   0x10(%ebp),%eax
  8010e1:	01 d0                	add    %edx,%eax
		if (*s >= '0' && *s <= '9')
  8010e3:	0f b6 11             	movzbl (%ecx),%edx
  8010e6:	8d 72 d0             	lea    -0x30(%edx),%esi
  8010e9:	89 f3                	mov    %esi,%ebx
  8010eb:	80 fb 09             	cmp    $0x9,%bl
  8010ee:	76 df                	jbe    8010cf <strtol+0x80>
		else if (*s >= 'a' && *s <= 'z')
  8010f0:	8d 72 9f             	lea    -0x61(%edx),%esi
  8010f3:	89 f3                	mov    %esi,%ebx
  8010f5:	80 fb 19             	cmp    $0x19,%bl
  8010f8:	77 08                	ja     801102 <strtol+0xb3>
			dig = *s - 'a' + 10;
  8010fa:	0f be d2             	movsbl %dl,%edx
  8010fd:	83 ea 57             	sub    $0x57,%edx
  801100:	eb d3                	jmp    8010d5 <strtol+0x86>
		else if (*s >= 'A' && *s <= 'Z')
  801102:	8d 72 bf             	lea    -0x41(%edx),%esi
  801105:	89 f3                	mov    %esi,%ebx
  801107:	80 fb 19             	cmp    $0x19,%bl
  80110a:	77 08                	ja     801114 <strtol+0xc5>
			dig = *s - 'A' + 10;
  80110c:	0f be d2             	movsbl %dl,%edx
  80110f:	83 ea 37             	sub    $0x37,%edx
  801112:	eb c1                	jmp    8010d5 <strtol+0x86>
		// we don't properly detect overflow!
	}

	if (endptr)
  801114:	83 7d 0c 00          	cmpl   $0x0,0xc(%ebp)
  801118:	74 05                	je     80111f <strtol+0xd0>
		*endptr = (char *) s;
  80111a:	8b 75 0c             	mov    0xc(%ebp),%esi
  80111d:	89 0e                	mov    %ecx,(%esi)
	return (neg ? -val : val);
  80111f:	89 c2                	mov    %eax,%edx
  801121:	f7 da                	neg    %edx
  801123:	85 ff                	test   %edi,%edi
  801125:	0f 45 c2             	cmovne %edx,%eax
}
  801128:	5b                   	pop    %ebx
  801129:	5e                   	pop    %esi
  80112a:	5f                   	pop    %edi
  80112b:	5d                   	pop    %ebp
  80112c:	c3                   	ret    

0080112d <sys_cputs>:
	return ret;
}

void
sys_cputs(const char *s, size_t len)
{
  80112d:	f3 0f 1e fb          	endbr32 
  801131:	55                   	push   %ebp
  801132:	89 e5                	mov    %esp,%ebp
  801134:	57                   	push   %edi
  801135:	56                   	push   %esi
  801136:	53                   	push   %ebx
	asm volatile("int %1\n"
  801137:	b8 00 00 00 00       	mov    $0x0,%eax
  80113c:	8b 55 08             	mov    0x8(%ebp),%edx
  80113f:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  801142:	89 c3                	mov    %eax,%ebx
  801144:	89 c7                	mov    %eax,%edi
  801146:	89 c6                	mov    %eax,%esi
  801148:	cd 30                	int    $0x30
	syscall(SYS_cputs, 0, (uint32_t)s, len, 0, 0, 0);
}
  80114a:	5b                   	pop    %ebx
  80114b:	5e                   	pop    %esi
  80114c:	5f                   	pop    %edi
  80114d:	5d                   	pop    %ebp
  80114e:	c3                   	ret    

0080114f <sys_cgetc>:

int
sys_cgetc(void)
{
  80114f:	f3 0f 1e fb          	endbr32 
  801153:	55                   	push   %ebp
  801154:	89 e5                	mov    %esp,%ebp
  801156:	57                   	push   %edi
  801157:	56                   	push   %esi
  801158:	53                   	push   %ebx
	asm volatile("int %1\n"
  801159:	ba 00 00 00 00       	mov    $0x0,%edx
  80115e:	b8 01 00 00 00       	mov    $0x1,%eax
  801163:	89 d1                	mov    %edx,%ecx
  801165:	89 d3                	mov    %edx,%ebx
  801167:	89 d7                	mov    %edx,%edi
  801169:	89 d6                	mov    %edx,%esi
  80116b:	cd 30                	int    $0x30
	return syscall(SYS_cgetc, 0, 0, 0, 0, 0, 0);
}
  80116d:	5b                   	pop    %ebx
  80116e:	5e                   	pop    %esi
  80116f:	5f                   	pop    %edi
  801170:	5d                   	pop    %ebp
  801171:	c3                   	ret    

00801172 <sys_env_destroy>:

int
sys_env_destroy(envid_t envid)
{
  801172:	f3 0f 1e fb          	endbr32 
  801176:	55                   	push   %ebp
  801177:	89 e5                	mov    %esp,%ebp
  801179:	57                   	push   %edi
  80117a:	56                   	push   %esi
  80117b:	53                   	push   %ebx
  80117c:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  80117f:	b9 00 00 00 00       	mov    $0x0,%ecx
  801184:	8b 55 08             	mov    0x8(%ebp),%edx
  801187:	b8 03 00 00 00       	mov    $0x3,%eax
  80118c:	89 cb                	mov    %ecx,%ebx
  80118e:	89 cf                	mov    %ecx,%edi
  801190:	89 ce                	mov    %ecx,%esi
  801192:	cd 30                	int    $0x30
	if(check && ret > 0)
  801194:	85 c0                	test   %eax,%eax
  801196:	7f 08                	jg     8011a0 <sys_env_destroy+0x2e>
	return syscall(SYS_env_destroy, 1, envid, 0, 0, 0, 0);
}
  801198:	8d 65 f4             	lea    -0xc(%ebp),%esp
  80119b:	5b                   	pop    %ebx
  80119c:	5e                   	pop    %esi
  80119d:	5f                   	pop    %edi
  80119e:	5d                   	pop    %ebp
  80119f:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  8011a0:	83 ec 0c             	sub    $0xc,%esp
  8011a3:	50                   	push   %eax
  8011a4:	6a 03                	push   $0x3
  8011a6:	68 1f 2c 80 00       	push   $0x802c1f
  8011ab:	6a 23                	push   $0x23
  8011ad:	68 3c 2c 80 00       	push   $0x802c3c
  8011b2:	e8 44 f5 ff ff       	call   8006fb <_panic>

008011b7 <sys_getenvid>:

envid_t
sys_getenvid(void)
{
  8011b7:	f3 0f 1e fb          	endbr32 
  8011bb:	55                   	push   %ebp
  8011bc:	89 e5                	mov    %esp,%ebp
  8011be:	57                   	push   %edi
  8011bf:	56                   	push   %esi
  8011c0:	53                   	push   %ebx
	asm volatile("int %1\n"
  8011c1:	ba 00 00 00 00       	mov    $0x0,%edx
  8011c6:	b8 02 00 00 00       	mov    $0x2,%eax
  8011cb:	89 d1                	mov    %edx,%ecx
  8011cd:	89 d3                	mov    %edx,%ebx
  8011cf:	89 d7                	mov    %edx,%edi
  8011d1:	89 d6                	mov    %edx,%esi
  8011d3:	cd 30                	int    $0x30
	 return syscall(SYS_getenvid, 0, 0, 0, 0, 0, 0);
}
  8011d5:	5b                   	pop    %ebx
  8011d6:	5e                   	pop    %esi
  8011d7:	5f                   	pop    %edi
  8011d8:	5d                   	pop    %ebp
  8011d9:	c3                   	ret    

008011da <sys_yield>:

void
sys_yield(void)
{
  8011da:	f3 0f 1e fb          	endbr32 
  8011de:	55                   	push   %ebp
  8011df:	89 e5                	mov    %esp,%ebp
  8011e1:	57                   	push   %edi
  8011e2:	56                   	push   %esi
  8011e3:	53                   	push   %ebx
	asm volatile("int %1\n"
  8011e4:	ba 00 00 00 00       	mov    $0x0,%edx
  8011e9:	b8 0b 00 00 00       	mov    $0xb,%eax
  8011ee:	89 d1                	mov    %edx,%ecx
  8011f0:	89 d3                	mov    %edx,%ebx
  8011f2:	89 d7                	mov    %edx,%edi
  8011f4:	89 d6                	mov    %edx,%esi
  8011f6:	cd 30                	int    $0x30
	syscall(SYS_yield, 0, 0, 0, 0, 0, 0);
}
  8011f8:	5b                   	pop    %ebx
  8011f9:	5e                   	pop    %esi
  8011fa:	5f                   	pop    %edi
  8011fb:	5d                   	pop    %ebp
  8011fc:	c3                   	ret    

008011fd <sys_page_alloc>:

int
sys_page_alloc(envid_t envid, void *va, int perm)
{
  8011fd:	f3 0f 1e fb          	endbr32 
  801201:	55                   	push   %ebp
  801202:	89 e5                	mov    %esp,%ebp
  801204:	57                   	push   %edi
  801205:	56                   	push   %esi
  801206:	53                   	push   %ebx
  801207:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  80120a:	be 00 00 00 00       	mov    $0x0,%esi
  80120f:	8b 55 08             	mov    0x8(%ebp),%edx
  801212:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  801215:	b8 04 00 00 00       	mov    $0x4,%eax
  80121a:	8b 5d 10             	mov    0x10(%ebp),%ebx
  80121d:	89 f7                	mov    %esi,%edi
  80121f:	cd 30                	int    $0x30
	if(check && ret > 0)
  801221:	85 c0                	test   %eax,%eax
  801223:	7f 08                	jg     80122d <sys_page_alloc+0x30>
	return syscall(SYS_page_alloc, 1, envid, (uint32_t) va, perm, 0, 0);
}
  801225:	8d 65 f4             	lea    -0xc(%ebp),%esp
  801228:	5b                   	pop    %ebx
  801229:	5e                   	pop    %esi
  80122a:	5f                   	pop    %edi
  80122b:	5d                   	pop    %ebp
  80122c:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  80122d:	83 ec 0c             	sub    $0xc,%esp
  801230:	50                   	push   %eax
  801231:	6a 04                	push   $0x4
  801233:	68 1f 2c 80 00       	push   $0x802c1f
  801238:	6a 23                	push   $0x23
  80123a:	68 3c 2c 80 00       	push   $0x802c3c
  80123f:	e8 b7 f4 ff ff       	call   8006fb <_panic>

00801244 <sys_page_map>:

int
sys_page_map(envid_t srcenv, void *srcva, envid_t dstenv, void *dstva, int perm)
{
  801244:	f3 0f 1e fb          	endbr32 
  801248:	55                   	push   %ebp
  801249:	89 e5                	mov    %esp,%ebp
  80124b:	57                   	push   %edi
  80124c:	56                   	push   %esi
  80124d:	53                   	push   %ebx
  80124e:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  801251:	8b 55 08             	mov    0x8(%ebp),%edx
  801254:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  801257:	b8 05 00 00 00       	mov    $0x5,%eax
  80125c:	8b 5d 10             	mov    0x10(%ebp),%ebx
  80125f:	8b 7d 14             	mov    0x14(%ebp),%edi
  801262:	8b 75 18             	mov    0x18(%ebp),%esi
  801265:	cd 30                	int    $0x30
	if(check && ret > 0)
  801267:	85 c0                	test   %eax,%eax
  801269:	7f 08                	jg     801273 <sys_page_map+0x2f>
	return syscall(SYS_page_map, 1, srcenv, (uint32_t) srcva, dstenv, (uint32_t) dstva, perm);
}
  80126b:	8d 65 f4             	lea    -0xc(%ebp),%esp
  80126e:	5b                   	pop    %ebx
  80126f:	5e                   	pop    %esi
  801270:	5f                   	pop    %edi
  801271:	5d                   	pop    %ebp
  801272:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  801273:	83 ec 0c             	sub    $0xc,%esp
  801276:	50                   	push   %eax
  801277:	6a 05                	push   $0x5
  801279:	68 1f 2c 80 00       	push   $0x802c1f
  80127e:	6a 23                	push   $0x23
  801280:	68 3c 2c 80 00       	push   $0x802c3c
  801285:	e8 71 f4 ff ff       	call   8006fb <_panic>

0080128a <sys_page_unmap>:

int
sys_page_unmap(envid_t envid, void *va)
{
  80128a:	f3 0f 1e fb          	endbr32 
  80128e:	55                   	push   %ebp
  80128f:	89 e5                	mov    %esp,%ebp
  801291:	57                   	push   %edi
  801292:	56                   	push   %esi
  801293:	53                   	push   %ebx
  801294:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  801297:	bb 00 00 00 00       	mov    $0x0,%ebx
  80129c:	8b 55 08             	mov    0x8(%ebp),%edx
  80129f:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  8012a2:	b8 06 00 00 00       	mov    $0x6,%eax
  8012a7:	89 df                	mov    %ebx,%edi
  8012a9:	89 de                	mov    %ebx,%esi
  8012ab:	cd 30                	int    $0x30
	if(check && ret > 0)
  8012ad:	85 c0                	test   %eax,%eax
  8012af:	7f 08                	jg     8012b9 <sys_page_unmap+0x2f>
	return syscall(SYS_page_unmap, 1, envid, (uint32_t) va, 0, 0, 0);
}
  8012b1:	8d 65 f4             	lea    -0xc(%ebp),%esp
  8012b4:	5b                   	pop    %ebx
  8012b5:	5e                   	pop    %esi
  8012b6:	5f                   	pop    %edi
  8012b7:	5d                   	pop    %ebp
  8012b8:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  8012b9:	83 ec 0c             	sub    $0xc,%esp
  8012bc:	50                   	push   %eax
  8012bd:	6a 06                	push   $0x6
  8012bf:	68 1f 2c 80 00       	push   $0x802c1f
  8012c4:	6a 23                	push   $0x23
  8012c6:	68 3c 2c 80 00       	push   $0x802c3c
  8012cb:	e8 2b f4 ff ff       	call   8006fb <_panic>

008012d0 <sys_env_set_status>:

// sys_exofork is inlined in lib.h

int
sys_env_set_status(envid_t envid, int status)
{
  8012d0:	f3 0f 1e fb          	endbr32 
  8012d4:	55                   	push   %ebp
  8012d5:	89 e5                	mov    %esp,%ebp
  8012d7:	57                   	push   %edi
  8012d8:	56                   	push   %esi
  8012d9:	53                   	push   %ebx
  8012da:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  8012dd:	bb 00 00 00 00       	mov    $0x0,%ebx
  8012e2:	8b 55 08             	mov    0x8(%ebp),%edx
  8012e5:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  8012e8:	b8 08 00 00 00       	mov    $0x8,%eax
  8012ed:	89 df                	mov    %ebx,%edi
  8012ef:	89 de                	mov    %ebx,%esi
  8012f1:	cd 30                	int    $0x30
	if(check && ret > 0)
  8012f3:	85 c0                	test   %eax,%eax
  8012f5:	7f 08                	jg     8012ff <sys_env_set_status+0x2f>
	return syscall(SYS_env_set_status, 1, envid, status, 0, 0, 0);
}
  8012f7:	8d 65 f4             	lea    -0xc(%ebp),%esp
  8012fa:	5b                   	pop    %ebx
  8012fb:	5e                   	pop    %esi
  8012fc:	5f                   	pop    %edi
  8012fd:	5d                   	pop    %ebp
  8012fe:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  8012ff:	83 ec 0c             	sub    $0xc,%esp
  801302:	50                   	push   %eax
  801303:	6a 08                	push   $0x8
  801305:	68 1f 2c 80 00       	push   $0x802c1f
  80130a:	6a 23                	push   $0x23
  80130c:	68 3c 2c 80 00       	push   $0x802c3c
  801311:	e8 e5 f3 ff ff       	call   8006fb <_panic>

00801316 <sys_env_set_trapframe>:

int
sys_env_set_trapframe(envid_t envid, struct Trapframe *tf)
{
  801316:	f3 0f 1e fb          	endbr32 
  80131a:	55                   	push   %ebp
  80131b:	89 e5                	mov    %esp,%ebp
  80131d:	57                   	push   %edi
  80131e:	56                   	push   %esi
  80131f:	53                   	push   %ebx
  801320:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  801323:	bb 00 00 00 00       	mov    $0x0,%ebx
  801328:	8b 55 08             	mov    0x8(%ebp),%edx
  80132b:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  80132e:	b8 09 00 00 00       	mov    $0x9,%eax
  801333:	89 df                	mov    %ebx,%edi
  801335:	89 de                	mov    %ebx,%esi
  801337:	cd 30                	int    $0x30
	if(check && ret > 0)
  801339:	85 c0                	test   %eax,%eax
  80133b:	7f 08                	jg     801345 <sys_env_set_trapframe+0x2f>
	return syscall(SYS_env_set_trapframe, 1, envid, (uint32_t) tf, 0, 0, 0);
}
  80133d:	8d 65 f4             	lea    -0xc(%ebp),%esp
  801340:	5b                   	pop    %ebx
  801341:	5e                   	pop    %esi
  801342:	5f                   	pop    %edi
  801343:	5d                   	pop    %ebp
  801344:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  801345:	83 ec 0c             	sub    $0xc,%esp
  801348:	50                   	push   %eax
  801349:	6a 09                	push   $0x9
  80134b:	68 1f 2c 80 00       	push   $0x802c1f
  801350:	6a 23                	push   $0x23
  801352:	68 3c 2c 80 00       	push   $0x802c3c
  801357:	e8 9f f3 ff ff       	call   8006fb <_panic>

0080135c <sys_env_set_pgfault_upcall>:

int
sys_env_set_pgfault_upcall(envid_t envid, void *upcall)
{
  80135c:	f3 0f 1e fb          	endbr32 
  801360:	55                   	push   %ebp
  801361:	89 e5                	mov    %esp,%ebp
  801363:	57                   	push   %edi
  801364:	56                   	push   %esi
  801365:	53                   	push   %ebx
  801366:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  801369:	bb 00 00 00 00       	mov    $0x0,%ebx
  80136e:	8b 55 08             	mov    0x8(%ebp),%edx
  801371:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  801374:	b8 0a 00 00 00       	mov    $0xa,%eax
  801379:	89 df                	mov    %ebx,%edi
  80137b:	89 de                	mov    %ebx,%esi
  80137d:	cd 30                	int    $0x30
	if(check && ret > 0)
  80137f:	85 c0                	test   %eax,%eax
  801381:	7f 08                	jg     80138b <sys_env_set_pgfault_upcall+0x2f>
	return syscall(SYS_env_set_pgfault_upcall, 1, envid, (uint32_t) upcall, 0, 0, 0);
}
  801383:	8d 65 f4             	lea    -0xc(%ebp),%esp
  801386:	5b                   	pop    %ebx
  801387:	5e                   	pop    %esi
  801388:	5f                   	pop    %edi
  801389:	5d                   	pop    %ebp
  80138a:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  80138b:	83 ec 0c             	sub    $0xc,%esp
  80138e:	50                   	push   %eax
  80138f:	6a 0a                	push   $0xa
  801391:	68 1f 2c 80 00       	push   $0x802c1f
  801396:	6a 23                	push   $0x23
  801398:	68 3c 2c 80 00       	push   $0x802c3c
  80139d:	e8 59 f3 ff ff       	call   8006fb <_panic>

008013a2 <sys_ipc_try_send>:

int
sys_ipc_try_send(envid_t envid, uint32_t value, void *srcva, int perm)
{
  8013a2:	f3 0f 1e fb          	endbr32 
  8013a6:	55                   	push   %ebp
  8013a7:	89 e5                	mov    %esp,%ebp
  8013a9:	57                   	push   %edi
  8013aa:	56                   	push   %esi
  8013ab:	53                   	push   %ebx
	asm volatile("int %1\n"
  8013ac:	8b 55 08             	mov    0x8(%ebp),%edx
  8013af:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  8013b2:	b8 0c 00 00 00       	mov    $0xc,%eax
  8013b7:	be 00 00 00 00       	mov    $0x0,%esi
  8013bc:	8b 5d 10             	mov    0x10(%ebp),%ebx
  8013bf:	8b 7d 14             	mov    0x14(%ebp),%edi
  8013c2:	cd 30                	int    $0x30
	return syscall(SYS_ipc_try_send, 0, envid, value, (uint32_t) srcva, perm, 0);
}
  8013c4:	5b                   	pop    %ebx
  8013c5:	5e                   	pop    %esi
  8013c6:	5f                   	pop    %edi
  8013c7:	5d                   	pop    %ebp
  8013c8:	c3                   	ret    

008013c9 <sys_ipc_recv>:

int
sys_ipc_recv(void *dstva)
{
  8013c9:	f3 0f 1e fb          	endbr32 
  8013cd:	55                   	push   %ebp
  8013ce:	89 e5                	mov    %esp,%ebp
  8013d0:	57                   	push   %edi
  8013d1:	56                   	push   %esi
  8013d2:	53                   	push   %ebx
  8013d3:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  8013d6:	b9 00 00 00 00       	mov    $0x0,%ecx
  8013db:	8b 55 08             	mov    0x8(%ebp),%edx
  8013de:	b8 0d 00 00 00       	mov    $0xd,%eax
  8013e3:	89 cb                	mov    %ecx,%ebx
  8013e5:	89 cf                	mov    %ecx,%edi
  8013e7:	89 ce                	mov    %ecx,%esi
  8013e9:	cd 30                	int    $0x30
	if(check && ret > 0)
  8013eb:	85 c0                	test   %eax,%eax
  8013ed:	7f 08                	jg     8013f7 <sys_ipc_recv+0x2e>
	return syscall(SYS_ipc_recv, 1, (uint32_t)dstva, 0, 0, 0, 0);
}
  8013ef:	8d 65 f4             	lea    -0xc(%ebp),%esp
  8013f2:	5b                   	pop    %ebx
  8013f3:	5e                   	pop    %esi
  8013f4:	5f                   	pop    %edi
  8013f5:	5d                   	pop    %ebp
  8013f6:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  8013f7:	83 ec 0c             	sub    $0xc,%esp
  8013fa:	50                   	push   %eax
  8013fb:	6a 0d                	push   $0xd
  8013fd:	68 1f 2c 80 00       	push   $0x802c1f
  801402:	6a 23                	push   $0x23
  801404:	68 3c 2c 80 00       	push   $0x802c3c
  801409:	e8 ed f2 ff ff       	call   8006fb <_panic>

0080140e <ipc_recv>:
//   If 'pg' is null, pass sys_ipc_recv a value that it will understand
//   as meaning "no page".  (Zero is not the right value, since that's
//   a perfectly valid place to map a page.)
int32_t
ipc_recv(envid_t *from_env_store, void *pg, int *perm_store)
{
  80140e:	f3 0f 1e fb          	endbr32 
  801412:	55                   	push   %ebp
  801413:	89 e5                	mov    %esp,%ebp
  801415:	56                   	push   %esi
  801416:	53                   	push   %ebx
  801417:	8b 75 08             	mov    0x8(%ebp),%esi
  80141a:	8b 45 0c             	mov    0xc(%ebp),%eax
  80141d:	8b 5d 10             	mov    0x10(%ebp),%ebx
	// LAB 4: Your code here.
	int error;
	if(!pg)pg = (void *)UTOP; // 如果设置为UTOP，这个值其实可以比UTOP大，设置为这个值认为pg无效了，不会进行页面传递【共享页面的设置】，而是只进行值value的传递。
  801420:	85 c0                	test   %eax,%eax
  801422:	ba 00 00 c0 ee       	mov    $0xeec00000,%edx
  801427:	0f 44 c2             	cmove  %edx,%eax
	if((error = sys_ipc_recv(pg)) < 0){
  80142a:	83 ec 0c             	sub    $0xc,%esp
  80142d:	50                   	push   %eax
  80142e:	e8 96 ff ff ff       	call   8013c9 <sys_ipc_recv>
  801433:	83 c4 10             	add    $0x10,%esp
  801436:	85 c0                	test   %eax,%eax
  801438:	78 3f                	js     801479 <ipc_recv+0x6b>
		if(from_env_store)*from_env_store = 0;
		if(perm_store)*perm_store = 0;
		return error;
	}

	thisenv = &envs[ENVX(sys_getenvid())]; // for lab4's challenge sfork().
  80143a:	e8 78 fd ff ff       	call   8011b7 <sys_getenvid>
  80143f:	25 ff 03 00 00       	and    $0x3ff,%eax
  801444:	6b d0 7c             	imul   $0x7c,%eax,%edx
  801447:	81 c2 00 00 c0 ee    	add    $0xeec00000,%edx
  80144d:	89 15 04 40 80 00    	mov    %edx,0x804004

	if(from_env_store)*from_env_store = thisenv->env_ipc_from;
  801453:	85 f6                	test   %esi,%esi
  801455:	74 05                	je     80145c <ipc_recv+0x4e>
  801457:	8b 42 74             	mov    0x74(%edx),%eax
  80145a:	89 06                	mov    %eax,(%esi)
	if(perm_store)*perm_store = thisenv->env_ipc_perm;
  80145c:	85 db                	test   %ebx,%ebx
  80145e:	74 0a                	je     80146a <ipc_recv+0x5c>
  801460:	a1 04 40 80 00       	mov    0x804004,%eax
  801465:	8b 40 78             	mov    0x78(%eax),%eax
  801468:	89 03                	mov    %eax,(%ebx)
	return thisenv->env_ipc_value;
  80146a:	a1 04 40 80 00       	mov    0x804004,%eax
  80146f:	8b 40 70             	mov    0x70(%eax),%eax
}
  801472:	8d 65 f8             	lea    -0x8(%ebp),%esp
  801475:	5b                   	pop    %ebx
  801476:	5e                   	pop    %esi
  801477:	5d                   	pop    %ebp
  801478:	c3                   	ret    
		if(from_env_store)*from_env_store = 0;
  801479:	85 f6                	test   %esi,%esi
  80147b:	74 06                	je     801483 <ipc_recv+0x75>
  80147d:	c7 06 00 00 00 00    	movl   $0x0,(%esi)
		if(perm_store)*perm_store = 0;
  801483:	85 db                	test   %ebx,%ebx
  801485:	74 eb                	je     801472 <ipc_recv+0x64>
  801487:	c7 03 00 00 00 00    	movl   $0x0,(%ebx)
  80148d:	eb e3                	jmp    801472 <ipc_recv+0x64>

0080148f <ipc_send>:
//   Use sys_yield() to be CPU-friendly.
//   If 'pg' is null, pass sys_ipc_try_send a value that it will understand
//   as meaning "no page".  (Zero is not the right value.)
void
ipc_send(envid_t to_env, uint32_t val, void *pg, int perm)
{
  80148f:	f3 0f 1e fb          	endbr32 
  801493:	55                   	push   %ebp
  801494:	89 e5                	mov    %esp,%ebp
  801496:	57                   	push   %edi
  801497:	56                   	push   %esi
  801498:	53                   	push   %ebx
  801499:	83 ec 0c             	sub    $0xc,%esp
  80149c:	8b 7d 08             	mov    0x8(%ebp),%edi
  80149f:	8b 75 0c             	mov    0xc(%ebp),%esi
  8014a2:	8b 5d 10             	mov    0x10(%ebp),%ebx
	// LAB 4: Your code here.
	if(!pg)pg = (void *)UTOP; // 不会进行页面共享，只会sending message。
  8014a5:	85 db                	test   %ebx,%ebx
  8014a7:	b8 00 00 c0 ee       	mov    $0xeec00000,%eax
  8014ac:	0f 44 d8             	cmove  %eax,%ebx
	int error;
	// Keep trying until it succeeds.
	while((error = sys_ipc_try_send(to_env, val, pg, perm)) < 0){
  8014af:	ff 75 14             	pushl  0x14(%ebp)
  8014b2:	53                   	push   %ebx
  8014b3:	56                   	push   %esi
  8014b4:	57                   	push   %edi
  8014b5:	e8 e8 fe ff ff       	call   8013a2 <sys_ipc_try_send>
  8014ba:	83 c4 10             	add    $0x10,%esp
  8014bd:	85 c0                	test   %eax,%eax
  8014bf:	79 1e                	jns    8014df <ipc_send+0x50>
        //如果error是没有接收者，那么就会继续尝试send
		if(error != -E_IPC_NOT_RECV){
  8014c1:	83 f8 f9             	cmp    $0xfffffff9,%eax
  8014c4:	75 07                	jne    8014cd <ipc_send+0x3e>
			panic("sys_ipc_try_send:%e", error);
		}
        //但是不是一味的占用cpu，而是尝试一次就释放CPU，等待再次被调度，才会重新send，寻找receiver。
		sys_yield(); // To be CPU-friendly.
  8014c6:	e8 0f fd ff ff       	call   8011da <sys_yield>
  8014cb:	eb e2                	jmp    8014af <ipc_send+0x20>
			panic("sys_ipc_try_send:%e", error);
  8014cd:	50                   	push   %eax
  8014ce:	68 4a 2c 80 00       	push   $0x802c4a
  8014d3:	6a 3b                	push   $0x3b
  8014d5:	68 5e 2c 80 00       	push   $0x802c5e
  8014da:	e8 1c f2 ff ff       	call   8006fb <_panic>
	}
}
  8014df:	8d 65 f4             	lea    -0xc(%ebp),%esp
  8014e2:	5b                   	pop    %ebx
  8014e3:	5e                   	pop    %esi
  8014e4:	5f                   	pop    %edi
  8014e5:	5d                   	pop    %ebp
  8014e6:	c3                   	ret    

008014e7 <ipc_find_env>:
// Find the first environment of the given type.  We'll use this to
// find special environments.
// Returns 0 if no such environment exists.
envid_t
ipc_find_env(enum EnvType type)
{
  8014e7:	f3 0f 1e fb          	endbr32 
  8014eb:	55                   	push   %ebp
  8014ec:	89 e5                	mov    %esp,%ebp
  8014ee:	8b 4d 08             	mov    0x8(%ebp),%ecx
	int i;
	for (i = 0; i < NENV; i++)
  8014f1:	b8 00 00 00 00       	mov    $0x0,%eax
		if (envs[i].env_type == type)
  8014f6:	6b d0 7c             	imul   $0x7c,%eax,%edx
  8014f9:	81 c2 00 00 c0 ee    	add    $0xeec00000,%edx
  8014ff:	8b 52 50             	mov    0x50(%edx),%edx
  801502:	39 ca                	cmp    %ecx,%edx
  801504:	74 11                	je     801517 <ipc_find_env+0x30>
	for (i = 0; i < NENV; i++)
  801506:	83 c0 01             	add    $0x1,%eax
  801509:	3d 00 04 00 00       	cmp    $0x400,%eax
  80150e:	75 e6                	jne    8014f6 <ipc_find_env+0xf>
			return envs[i].env_id;
	return 0;
  801510:	b8 00 00 00 00       	mov    $0x0,%eax
  801515:	eb 0b                	jmp    801522 <ipc_find_env+0x3b>
			return envs[i].env_id;
  801517:	6b c0 7c             	imul   $0x7c,%eax,%eax
  80151a:	05 00 00 c0 ee       	add    $0xeec00000,%eax
  80151f:	8b 40 48             	mov    0x48(%eax),%eax
}
  801522:	5d                   	pop    %ebp
  801523:	c3                   	ret    

00801524 <fd2num>:
// File descriptor manipulators
// --------------------------------------------------------------

int
fd2num(struct Fd *fd)
{
  801524:	f3 0f 1e fb          	endbr32 
  801528:	55                   	push   %ebp
  801529:	89 e5                	mov    %esp,%ebp
	return ((uintptr_t) fd - FDTABLE) / PGSIZE;
  80152b:	8b 45 08             	mov    0x8(%ebp),%eax
  80152e:	05 00 00 00 30       	add    $0x30000000,%eax
  801533:	c1 e8 0c             	shr    $0xc,%eax
}
  801536:	5d                   	pop    %ebp
  801537:	c3                   	ret    

00801538 <fd2data>:

char*
fd2data(struct Fd *fd)
{
  801538:	f3 0f 1e fb          	endbr32 
  80153c:	55                   	push   %ebp
  80153d:	89 e5                	mov    %esp,%ebp
	return ((uintptr_t) fd - FDTABLE) / PGSIZE;
  80153f:	8b 45 08             	mov    0x8(%ebp),%eax
  801542:	05 00 00 00 30       	add    $0x30000000,%eax
	return INDEX2DATA(fd2num(fd));
  801547:	25 00 f0 ff ff       	and    $0xfffff000,%eax
  80154c:	2d 00 00 fe 2f       	sub    $0x2ffe0000,%eax
}
  801551:	5d                   	pop    %ebp
  801552:	c3                   	ret    

00801553 <fd_alloc>:
// Returns 0 on success, < 0 on error.  Errors are:
//	-E_MAX_FD: no more file descriptors
// On error, *fd_store is set to 0.
int
fd_alloc(struct Fd **fd_store)
{
  801553:	f3 0f 1e fb          	endbr32 
  801557:	55                   	push   %ebp
  801558:	89 e5                	mov    %esp,%ebp
  80155a:	b8 00 00 00 d0       	mov    $0xd0000000,%eax
	int i;
	struct Fd *fd;

	for (i = 0; i < MAXFD; i++) {
		fd = INDEX2FD(i);
		if ((uvpd[PDX(fd)] & PTE_P) == 0 || (uvpt[PGNUM(fd)] & PTE_P) == 0) {
  80155f:	89 c2                	mov    %eax,%edx
  801561:	c1 ea 16             	shr    $0x16,%edx
  801564:	8b 14 95 00 d0 7b ef 	mov    -0x10843000(,%edx,4),%edx
  80156b:	f6 c2 01             	test   $0x1,%dl
  80156e:	74 2d                	je     80159d <fd_alloc+0x4a>
  801570:	89 c2                	mov    %eax,%edx
  801572:	c1 ea 0c             	shr    $0xc,%edx
  801575:	8b 14 95 00 00 40 ef 	mov    -0x10c00000(,%edx,4),%edx
  80157c:	f6 c2 01             	test   $0x1,%dl
  80157f:	74 1c                	je     80159d <fd_alloc+0x4a>
  801581:	05 00 10 00 00       	add    $0x1000,%eax
	for (i = 0; i < MAXFD; i++) {
  801586:	3d 00 00 02 d0       	cmp    $0xd0020000,%eax
  80158b:	75 d2                	jne    80155f <fd_alloc+0xc>
			*fd_store = fd;
			return 0;
		}
	}
	*fd_store = 0;
  80158d:	8b 45 08             	mov    0x8(%ebp),%eax
  801590:	c7 00 00 00 00 00    	movl   $0x0,(%eax)
	return -E_MAX_OPEN;
  801596:	b8 f6 ff ff ff       	mov    $0xfffffff6,%eax
  80159b:	eb 0a                	jmp    8015a7 <fd_alloc+0x54>
			*fd_store = fd;
  80159d:	8b 4d 08             	mov    0x8(%ebp),%ecx
  8015a0:	89 01                	mov    %eax,(%ecx)
			return 0;
  8015a2:	b8 00 00 00 00       	mov    $0x0,%eax
}
  8015a7:	5d                   	pop    %ebp
  8015a8:	c3                   	ret    

008015a9 <fd_lookup>:
// Returns 0 on success (the page is in range and mapped), < 0 on error.
// Errors are:
//	-E_INVAL: fdnum was either not in range or not mapped.
int
fd_lookup(int fdnum, struct Fd **fd_store)
{
  8015a9:	f3 0f 1e fb          	endbr32 
  8015ad:	55                   	push   %ebp
  8015ae:	89 e5                	mov    %esp,%ebp
  8015b0:	8b 45 08             	mov    0x8(%ebp),%eax
	struct Fd *fd;

	if (fdnum < 0 || fdnum >= MAXFD) {
  8015b3:	83 f8 1f             	cmp    $0x1f,%eax
  8015b6:	77 30                	ja     8015e8 <fd_lookup+0x3f>
		if (debug)
			cprintf("[%08x] bad fd %d\n", thisenv->env_id, fdnum);
		return -E_INVAL;
	}
	fd = INDEX2FD(fdnum);
  8015b8:	c1 e0 0c             	shl    $0xc,%eax
  8015bb:	2d 00 00 00 30       	sub    $0x30000000,%eax
	if (!(uvpd[PDX(fd)] & PTE_P) || !(uvpt[PGNUM(fd)] & PTE_P)) {
  8015c0:	8b 15 00 dd 7b ef    	mov    0xef7bdd00,%edx
  8015c6:	f6 c2 01             	test   $0x1,%dl
  8015c9:	74 24                	je     8015ef <fd_lookup+0x46>
  8015cb:	89 c2                	mov    %eax,%edx
  8015cd:	c1 ea 0c             	shr    $0xc,%edx
  8015d0:	8b 14 95 00 00 40 ef 	mov    -0x10c00000(,%edx,4),%edx
  8015d7:	f6 c2 01             	test   $0x1,%dl
  8015da:	74 1a                	je     8015f6 <fd_lookup+0x4d>
		if (debug)
			cprintf("[%08x] closed fd %d\n", thisenv->env_id, fdnum);
		return -E_INVAL;
	}
	*fd_store = fd;
  8015dc:	8b 55 0c             	mov    0xc(%ebp),%edx
  8015df:	89 02                	mov    %eax,(%edx)
	return 0;
  8015e1:	b8 00 00 00 00       	mov    $0x0,%eax
}
  8015e6:	5d                   	pop    %ebp
  8015e7:	c3                   	ret    
		return -E_INVAL;
  8015e8:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  8015ed:	eb f7                	jmp    8015e6 <fd_lookup+0x3d>
		return -E_INVAL;
  8015ef:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  8015f4:	eb f0                	jmp    8015e6 <fd_lookup+0x3d>
  8015f6:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  8015fb:	eb e9                	jmp    8015e6 <fd_lookup+0x3d>

008015fd <dev_lookup>:
	0
};

int
dev_lookup(int dev_id, struct Dev **dev)
{
  8015fd:	f3 0f 1e fb          	endbr32 
  801601:	55                   	push   %ebp
  801602:	89 e5                	mov    %esp,%ebp
  801604:	83 ec 08             	sub    $0x8,%esp
  801607:	8b 4d 08             	mov    0x8(%ebp),%ecx
  80160a:	ba e4 2c 80 00       	mov    $0x802ce4,%edx
	int i;
	for (i = 0; devtab[i]; i++)
  80160f:	b8 08 30 80 00       	mov    $0x803008,%eax
		if (devtab[i]->dev_id == dev_id) {
  801614:	39 08                	cmp    %ecx,(%eax)
  801616:	74 33                	je     80164b <dev_lookup+0x4e>
  801618:	83 c2 04             	add    $0x4,%edx
	for (i = 0; devtab[i]; i++)
  80161b:	8b 02                	mov    (%edx),%eax
  80161d:	85 c0                	test   %eax,%eax
  80161f:	75 f3                	jne    801614 <dev_lookup+0x17>
			*dev = devtab[i];
			return 0;
		}
	cprintf("[%08x] unknown device type %d\n", thisenv->env_id, dev_id);
  801621:	a1 04 40 80 00       	mov    0x804004,%eax
  801626:	8b 40 48             	mov    0x48(%eax),%eax
  801629:	83 ec 04             	sub    $0x4,%esp
  80162c:	51                   	push   %ecx
  80162d:	50                   	push   %eax
  80162e:	68 68 2c 80 00       	push   $0x802c68
  801633:	e8 aa f1 ff ff       	call   8007e2 <cprintf>
	*dev = 0;
  801638:	8b 45 0c             	mov    0xc(%ebp),%eax
  80163b:	c7 00 00 00 00 00    	movl   $0x0,(%eax)
	return -E_INVAL;
  801641:	83 c4 10             	add    $0x10,%esp
  801644:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
}
  801649:	c9                   	leave  
  80164a:	c3                   	ret    
			*dev = devtab[i];
  80164b:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  80164e:	89 01                	mov    %eax,(%ecx)
			return 0;
  801650:	b8 00 00 00 00       	mov    $0x0,%eax
  801655:	eb f2                	jmp    801649 <dev_lookup+0x4c>

00801657 <fd_close>:
{
  801657:	f3 0f 1e fb          	endbr32 
  80165b:	55                   	push   %ebp
  80165c:	89 e5                	mov    %esp,%ebp
  80165e:	57                   	push   %edi
  80165f:	56                   	push   %esi
  801660:	53                   	push   %ebx
  801661:	83 ec 24             	sub    $0x24,%esp
  801664:	8b 75 08             	mov    0x8(%ebp),%esi
  801667:	8b 7d 0c             	mov    0xc(%ebp),%edi
	if ((r = fd_lookup(fd2num(fd), &fd2)) < 0
  80166a:	8d 45 e4             	lea    -0x1c(%ebp),%eax
  80166d:	50                   	push   %eax
	return ((uintptr_t) fd - FDTABLE) / PGSIZE;
  80166e:	8d 86 00 00 00 30    	lea    0x30000000(%esi),%eax
  801674:	c1 e8 0c             	shr    $0xc,%eax
	if ((r = fd_lookup(fd2num(fd), &fd2)) < 0
  801677:	50                   	push   %eax
  801678:	e8 2c ff ff ff       	call   8015a9 <fd_lookup>
  80167d:	89 c3                	mov    %eax,%ebx
  80167f:	83 c4 10             	add    $0x10,%esp
  801682:	85 c0                	test   %eax,%eax
  801684:	78 05                	js     80168b <fd_close+0x34>
	    || fd != fd2)
  801686:	39 75 e4             	cmp    %esi,-0x1c(%ebp)
  801689:	74 16                	je     8016a1 <fd_close+0x4a>
		return (must_exist ? r : 0);
  80168b:	89 f8                	mov    %edi,%eax
  80168d:	84 c0                	test   %al,%al
  80168f:	b8 00 00 00 00       	mov    $0x0,%eax
  801694:	0f 44 d8             	cmove  %eax,%ebx
}
  801697:	89 d8                	mov    %ebx,%eax
  801699:	8d 65 f4             	lea    -0xc(%ebp),%esp
  80169c:	5b                   	pop    %ebx
  80169d:	5e                   	pop    %esi
  80169e:	5f                   	pop    %edi
  80169f:	5d                   	pop    %ebp
  8016a0:	c3                   	ret    
	if ((r = dev_lookup(fd->fd_dev_id, &dev)) >= 0) {
  8016a1:	83 ec 08             	sub    $0x8,%esp
  8016a4:	8d 45 e0             	lea    -0x20(%ebp),%eax
  8016a7:	50                   	push   %eax
  8016a8:	ff 36                	pushl  (%esi)
  8016aa:	e8 4e ff ff ff       	call   8015fd <dev_lookup>
  8016af:	89 c3                	mov    %eax,%ebx
  8016b1:	83 c4 10             	add    $0x10,%esp
  8016b4:	85 c0                	test   %eax,%eax
  8016b6:	78 1a                	js     8016d2 <fd_close+0x7b>
		if (dev->dev_close)
  8016b8:	8b 45 e0             	mov    -0x20(%ebp),%eax
  8016bb:	8b 40 10             	mov    0x10(%eax),%eax
			r = 0;
  8016be:	bb 00 00 00 00       	mov    $0x0,%ebx
		if (dev->dev_close)
  8016c3:	85 c0                	test   %eax,%eax
  8016c5:	74 0b                	je     8016d2 <fd_close+0x7b>
			r = (*dev->dev_close)(fd);
  8016c7:	83 ec 0c             	sub    $0xc,%esp
  8016ca:	56                   	push   %esi
  8016cb:	ff d0                	call   *%eax
  8016cd:	89 c3                	mov    %eax,%ebx
  8016cf:	83 c4 10             	add    $0x10,%esp
	(void) sys_page_unmap(0, fd);
  8016d2:	83 ec 08             	sub    $0x8,%esp
  8016d5:	56                   	push   %esi
  8016d6:	6a 00                	push   $0x0
  8016d8:	e8 ad fb ff ff       	call   80128a <sys_page_unmap>
	return r;
  8016dd:	83 c4 10             	add    $0x10,%esp
  8016e0:	eb b5                	jmp    801697 <fd_close+0x40>

008016e2 <close>:

int
close(int fdnum)
{
  8016e2:	f3 0f 1e fb          	endbr32 
  8016e6:	55                   	push   %ebp
  8016e7:	89 e5                	mov    %esp,%ebp
  8016e9:	83 ec 20             	sub    $0x20,%esp
	struct Fd *fd;
	int r;

	if ((r = fd_lookup(fdnum, &fd)) < 0)
  8016ec:	8d 45 f4             	lea    -0xc(%ebp),%eax
  8016ef:	50                   	push   %eax
  8016f0:	ff 75 08             	pushl  0x8(%ebp)
  8016f3:	e8 b1 fe ff ff       	call   8015a9 <fd_lookup>
  8016f8:	83 c4 10             	add    $0x10,%esp
  8016fb:	85 c0                	test   %eax,%eax
  8016fd:	79 02                	jns    801701 <close+0x1f>
		return r;
	else
		return fd_close(fd, 1);
}
  8016ff:	c9                   	leave  
  801700:	c3                   	ret    
		return fd_close(fd, 1);
  801701:	83 ec 08             	sub    $0x8,%esp
  801704:	6a 01                	push   $0x1
  801706:	ff 75 f4             	pushl  -0xc(%ebp)
  801709:	e8 49 ff ff ff       	call   801657 <fd_close>
  80170e:	83 c4 10             	add    $0x10,%esp
  801711:	eb ec                	jmp    8016ff <close+0x1d>

00801713 <close_all>:

void
close_all(void)
{
  801713:	f3 0f 1e fb          	endbr32 
  801717:	55                   	push   %ebp
  801718:	89 e5                	mov    %esp,%ebp
  80171a:	53                   	push   %ebx
  80171b:	83 ec 04             	sub    $0x4,%esp
	int i;
	for (i = 0; i < MAXFD; i++)
  80171e:	bb 00 00 00 00       	mov    $0x0,%ebx
		close(i);
  801723:	83 ec 0c             	sub    $0xc,%esp
  801726:	53                   	push   %ebx
  801727:	e8 b6 ff ff ff       	call   8016e2 <close>
	for (i = 0; i < MAXFD; i++)
  80172c:	83 c3 01             	add    $0x1,%ebx
  80172f:	83 c4 10             	add    $0x10,%esp
  801732:	83 fb 20             	cmp    $0x20,%ebx
  801735:	75 ec                	jne    801723 <close_all+0x10>
}
  801737:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  80173a:	c9                   	leave  
  80173b:	c3                   	ret    

0080173c <dup>:
// file and the file offset of the other.
// Closes any previously open file descriptor at 'newfdnum'.
// This is implemented using virtual memory tricks (of course!).
int
dup(int oldfdnum, int newfdnum)
{
  80173c:	f3 0f 1e fb          	endbr32 
  801740:	55                   	push   %ebp
  801741:	89 e5                	mov    %esp,%ebp
  801743:	57                   	push   %edi
  801744:	56                   	push   %esi
  801745:	53                   	push   %ebx
  801746:	83 ec 24             	sub    $0x24,%esp
	int r;
	char *ova, *nva;
	pte_t pte;
	struct Fd *oldfd, *newfd;

	if ((r = fd_lookup(oldfdnum, &oldfd)) < 0)
  801749:	8d 45 e4             	lea    -0x1c(%ebp),%eax
  80174c:	50                   	push   %eax
  80174d:	ff 75 08             	pushl  0x8(%ebp)
  801750:	e8 54 fe ff ff       	call   8015a9 <fd_lookup>
  801755:	89 c3                	mov    %eax,%ebx
  801757:	83 c4 10             	add    $0x10,%esp
  80175a:	85 c0                	test   %eax,%eax
  80175c:	0f 88 81 00 00 00    	js     8017e3 <dup+0xa7>
		return r;
	close(newfdnum);
  801762:	83 ec 0c             	sub    $0xc,%esp
  801765:	ff 75 0c             	pushl  0xc(%ebp)
  801768:	e8 75 ff ff ff       	call   8016e2 <close>

	newfd = INDEX2FD(newfdnum);
  80176d:	8b 75 0c             	mov    0xc(%ebp),%esi
  801770:	c1 e6 0c             	shl    $0xc,%esi
  801773:	81 ee 00 00 00 30    	sub    $0x30000000,%esi
	ova = fd2data(oldfd);
  801779:	83 c4 04             	add    $0x4,%esp
  80177c:	ff 75 e4             	pushl  -0x1c(%ebp)
  80177f:	e8 b4 fd ff ff       	call   801538 <fd2data>
  801784:	89 c3                	mov    %eax,%ebx
	nva = fd2data(newfd);
  801786:	89 34 24             	mov    %esi,(%esp)
  801789:	e8 aa fd ff ff       	call   801538 <fd2data>
  80178e:	83 c4 10             	add    $0x10,%esp
  801791:	89 c7                	mov    %eax,%edi

	if ((uvpd[PDX(ova)] & PTE_P) && (uvpt[PGNUM(ova)] & PTE_P))
  801793:	89 d8                	mov    %ebx,%eax
  801795:	c1 e8 16             	shr    $0x16,%eax
  801798:	8b 04 85 00 d0 7b ef 	mov    -0x10843000(,%eax,4),%eax
  80179f:	a8 01                	test   $0x1,%al
  8017a1:	74 11                	je     8017b4 <dup+0x78>
  8017a3:	89 d8                	mov    %ebx,%eax
  8017a5:	c1 e8 0c             	shr    $0xc,%eax
  8017a8:	8b 14 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%edx
  8017af:	f6 c2 01             	test   $0x1,%dl
  8017b2:	75 39                	jne    8017ed <dup+0xb1>
		if ((r = sys_page_map(0, ova, 0, nva, uvpt[PGNUM(ova)] & PTE_SYSCALL)) < 0)
			goto err;
	if ((r = sys_page_map(0, oldfd, 0, newfd, uvpt[PGNUM(oldfd)] & PTE_SYSCALL)) < 0)
  8017b4:	8b 55 e4             	mov    -0x1c(%ebp),%edx
  8017b7:	89 d0                	mov    %edx,%eax
  8017b9:	c1 e8 0c             	shr    $0xc,%eax
  8017bc:	8b 04 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%eax
  8017c3:	83 ec 0c             	sub    $0xc,%esp
  8017c6:	25 07 0e 00 00       	and    $0xe07,%eax
  8017cb:	50                   	push   %eax
  8017cc:	56                   	push   %esi
  8017cd:	6a 00                	push   $0x0
  8017cf:	52                   	push   %edx
  8017d0:	6a 00                	push   $0x0
  8017d2:	e8 6d fa ff ff       	call   801244 <sys_page_map>
  8017d7:	89 c3                	mov    %eax,%ebx
  8017d9:	83 c4 20             	add    $0x20,%esp
  8017dc:	85 c0                	test   %eax,%eax
  8017de:	78 31                	js     801811 <dup+0xd5>
		goto err;

	return newfdnum;
  8017e0:	8b 5d 0c             	mov    0xc(%ebp),%ebx

err:
	sys_page_unmap(0, newfd);
	sys_page_unmap(0, nva);
	return r;
}
  8017e3:	89 d8                	mov    %ebx,%eax
  8017e5:	8d 65 f4             	lea    -0xc(%ebp),%esp
  8017e8:	5b                   	pop    %ebx
  8017e9:	5e                   	pop    %esi
  8017ea:	5f                   	pop    %edi
  8017eb:	5d                   	pop    %ebp
  8017ec:	c3                   	ret    
		if ((r = sys_page_map(0, ova, 0, nva, uvpt[PGNUM(ova)] & PTE_SYSCALL)) < 0)
  8017ed:	8b 04 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%eax
  8017f4:	83 ec 0c             	sub    $0xc,%esp
  8017f7:	25 07 0e 00 00       	and    $0xe07,%eax
  8017fc:	50                   	push   %eax
  8017fd:	57                   	push   %edi
  8017fe:	6a 00                	push   $0x0
  801800:	53                   	push   %ebx
  801801:	6a 00                	push   $0x0
  801803:	e8 3c fa ff ff       	call   801244 <sys_page_map>
  801808:	89 c3                	mov    %eax,%ebx
  80180a:	83 c4 20             	add    $0x20,%esp
  80180d:	85 c0                	test   %eax,%eax
  80180f:	79 a3                	jns    8017b4 <dup+0x78>
	sys_page_unmap(0, newfd);
  801811:	83 ec 08             	sub    $0x8,%esp
  801814:	56                   	push   %esi
  801815:	6a 00                	push   $0x0
  801817:	e8 6e fa ff ff       	call   80128a <sys_page_unmap>
	sys_page_unmap(0, nva);
  80181c:	83 c4 08             	add    $0x8,%esp
  80181f:	57                   	push   %edi
  801820:	6a 00                	push   $0x0
  801822:	e8 63 fa ff ff       	call   80128a <sys_page_unmap>
	return r;
  801827:	83 c4 10             	add    $0x10,%esp
  80182a:	eb b7                	jmp    8017e3 <dup+0xa7>

0080182c <read>:

ssize_t
read(int fdnum, void *buf, size_t n)
{
  80182c:	f3 0f 1e fb          	endbr32 
  801830:	55                   	push   %ebp
  801831:	89 e5                	mov    %esp,%ebp
  801833:	53                   	push   %ebx
  801834:	83 ec 1c             	sub    $0x1c,%esp
  801837:	8b 5d 08             	mov    0x8(%ebp),%ebx
	int r;
	struct Dev *dev;
	struct Fd *fd;

	if ((r = fd_lookup(fdnum, &fd)) < 0
  80183a:	8d 45 f0             	lea    -0x10(%ebp),%eax
  80183d:	50                   	push   %eax
  80183e:	53                   	push   %ebx
  80183f:	e8 65 fd ff ff       	call   8015a9 <fd_lookup>
  801844:	83 c4 10             	add    $0x10,%esp
  801847:	85 c0                	test   %eax,%eax
  801849:	78 3f                	js     80188a <read+0x5e>
	    || (r = dev_lookup(fd->fd_dev_id, &dev)) < 0)
  80184b:	83 ec 08             	sub    $0x8,%esp
  80184e:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801851:	50                   	push   %eax
  801852:	8b 45 f0             	mov    -0x10(%ebp),%eax
  801855:	ff 30                	pushl  (%eax)
  801857:	e8 a1 fd ff ff       	call   8015fd <dev_lookup>
  80185c:	83 c4 10             	add    $0x10,%esp
  80185f:	85 c0                	test   %eax,%eax
  801861:	78 27                	js     80188a <read+0x5e>
		return r;
	if ((fd->fd_omode & O_ACCMODE) == O_WRONLY) {
  801863:	8b 55 f0             	mov    -0x10(%ebp),%edx
  801866:	8b 42 08             	mov    0x8(%edx),%eax
  801869:	83 e0 03             	and    $0x3,%eax
  80186c:	83 f8 01             	cmp    $0x1,%eax
  80186f:	74 1e                	je     80188f <read+0x63>
		cprintf("[%08x] read %d -- bad mode\n", thisenv->env_id, fdnum);
		return -E_INVAL;
	}
	if (!dev->dev_read)
  801871:	8b 45 f4             	mov    -0xc(%ebp),%eax
  801874:	8b 40 08             	mov    0x8(%eax),%eax
  801877:	85 c0                	test   %eax,%eax
  801879:	74 35                	je     8018b0 <read+0x84>
		return -E_NOT_SUPP;
	return (*dev->dev_read)(fd, buf, n);
  80187b:	83 ec 04             	sub    $0x4,%esp
  80187e:	ff 75 10             	pushl  0x10(%ebp)
  801881:	ff 75 0c             	pushl  0xc(%ebp)
  801884:	52                   	push   %edx
  801885:	ff d0                	call   *%eax
  801887:	83 c4 10             	add    $0x10,%esp
}
  80188a:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  80188d:	c9                   	leave  
  80188e:	c3                   	ret    
		cprintf("[%08x] read %d -- bad mode\n", thisenv->env_id, fdnum);
  80188f:	a1 04 40 80 00       	mov    0x804004,%eax
  801894:	8b 40 48             	mov    0x48(%eax),%eax
  801897:	83 ec 04             	sub    $0x4,%esp
  80189a:	53                   	push   %ebx
  80189b:	50                   	push   %eax
  80189c:	68 a9 2c 80 00       	push   $0x802ca9
  8018a1:	e8 3c ef ff ff       	call   8007e2 <cprintf>
		return -E_INVAL;
  8018a6:	83 c4 10             	add    $0x10,%esp
  8018a9:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  8018ae:	eb da                	jmp    80188a <read+0x5e>
		return -E_NOT_SUPP;
  8018b0:	b8 f1 ff ff ff       	mov    $0xfffffff1,%eax
  8018b5:	eb d3                	jmp    80188a <read+0x5e>

008018b7 <readn>:

ssize_t
readn(int fdnum, void *buf, size_t n)
{
  8018b7:	f3 0f 1e fb          	endbr32 
  8018bb:	55                   	push   %ebp
  8018bc:	89 e5                	mov    %esp,%ebp
  8018be:	57                   	push   %edi
  8018bf:	56                   	push   %esi
  8018c0:	53                   	push   %ebx
  8018c1:	83 ec 0c             	sub    $0xc,%esp
  8018c4:	8b 7d 08             	mov    0x8(%ebp),%edi
  8018c7:	8b 75 10             	mov    0x10(%ebp),%esi
	int m, tot;

	for (tot = 0; tot < n; tot += m) {
  8018ca:	bb 00 00 00 00       	mov    $0x0,%ebx
  8018cf:	eb 02                	jmp    8018d3 <readn+0x1c>
  8018d1:	01 c3                	add    %eax,%ebx
  8018d3:	39 f3                	cmp    %esi,%ebx
  8018d5:	73 21                	jae    8018f8 <readn+0x41>
		m = read(fdnum, (char*)buf + tot, n - tot);
  8018d7:	83 ec 04             	sub    $0x4,%esp
  8018da:	89 f0                	mov    %esi,%eax
  8018dc:	29 d8                	sub    %ebx,%eax
  8018de:	50                   	push   %eax
  8018df:	89 d8                	mov    %ebx,%eax
  8018e1:	03 45 0c             	add    0xc(%ebp),%eax
  8018e4:	50                   	push   %eax
  8018e5:	57                   	push   %edi
  8018e6:	e8 41 ff ff ff       	call   80182c <read>
		if (m < 0)
  8018eb:	83 c4 10             	add    $0x10,%esp
  8018ee:	85 c0                	test   %eax,%eax
  8018f0:	78 04                	js     8018f6 <readn+0x3f>
			return m;
		if (m == 0)
  8018f2:	75 dd                	jne    8018d1 <readn+0x1a>
  8018f4:	eb 02                	jmp    8018f8 <readn+0x41>
		m = read(fdnum, (char*)buf + tot, n - tot);
  8018f6:	89 c3                	mov    %eax,%ebx
			break;
	}
	return tot;
}
  8018f8:	89 d8                	mov    %ebx,%eax
  8018fa:	8d 65 f4             	lea    -0xc(%ebp),%esp
  8018fd:	5b                   	pop    %ebx
  8018fe:	5e                   	pop    %esi
  8018ff:	5f                   	pop    %edi
  801900:	5d                   	pop    %ebp
  801901:	c3                   	ret    

00801902 <write>:

ssize_t
write(int fdnum, const void *buf, size_t n)
{
  801902:	f3 0f 1e fb          	endbr32 
  801906:	55                   	push   %ebp
  801907:	89 e5                	mov    %esp,%ebp
  801909:	53                   	push   %ebx
  80190a:	83 ec 1c             	sub    $0x1c,%esp
  80190d:	8b 5d 08             	mov    0x8(%ebp),%ebx
	int r;
	struct Dev *dev;
	struct Fd *fd;

	if ((r = fd_lookup(fdnum, &fd)) < 0
  801910:	8d 45 f0             	lea    -0x10(%ebp),%eax
  801913:	50                   	push   %eax
  801914:	53                   	push   %ebx
  801915:	e8 8f fc ff ff       	call   8015a9 <fd_lookup>
  80191a:	83 c4 10             	add    $0x10,%esp
  80191d:	85 c0                	test   %eax,%eax
  80191f:	78 3a                	js     80195b <write+0x59>
	    || (r = dev_lookup(fd->fd_dev_id, &dev)) < 0)
  801921:	83 ec 08             	sub    $0x8,%esp
  801924:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801927:	50                   	push   %eax
  801928:	8b 45 f0             	mov    -0x10(%ebp),%eax
  80192b:	ff 30                	pushl  (%eax)
  80192d:	e8 cb fc ff ff       	call   8015fd <dev_lookup>
  801932:	83 c4 10             	add    $0x10,%esp
  801935:	85 c0                	test   %eax,%eax
  801937:	78 22                	js     80195b <write+0x59>
		return r;
	if ((fd->fd_omode & O_ACCMODE) == O_RDONLY) {
  801939:	8b 45 f0             	mov    -0x10(%ebp),%eax
  80193c:	f6 40 08 03          	testb  $0x3,0x8(%eax)
  801940:	74 1e                	je     801960 <write+0x5e>
		return -E_INVAL;
	}
	if (debug)
		cprintf("write %d %p %d via dev %s\n",
			fdnum, buf, n, dev->dev_name);
	if (!dev->dev_write)
  801942:	8b 55 f4             	mov    -0xc(%ebp),%edx
  801945:	8b 52 0c             	mov    0xc(%edx),%edx
  801948:	85 d2                	test   %edx,%edx
  80194a:	74 35                	je     801981 <write+0x7f>
		return -E_NOT_SUPP;
	return (*dev->dev_write)(fd, buf, n);
  80194c:	83 ec 04             	sub    $0x4,%esp
  80194f:	ff 75 10             	pushl  0x10(%ebp)
  801952:	ff 75 0c             	pushl  0xc(%ebp)
  801955:	50                   	push   %eax
  801956:	ff d2                	call   *%edx
  801958:	83 c4 10             	add    $0x10,%esp
}
  80195b:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  80195e:	c9                   	leave  
  80195f:	c3                   	ret    
		cprintf("[%08x] write %d -- bad mode\n", thisenv->env_id, fdnum);
  801960:	a1 04 40 80 00       	mov    0x804004,%eax
  801965:	8b 40 48             	mov    0x48(%eax),%eax
  801968:	83 ec 04             	sub    $0x4,%esp
  80196b:	53                   	push   %ebx
  80196c:	50                   	push   %eax
  80196d:	68 c5 2c 80 00       	push   $0x802cc5
  801972:	e8 6b ee ff ff       	call   8007e2 <cprintf>
		return -E_INVAL;
  801977:	83 c4 10             	add    $0x10,%esp
  80197a:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  80197f:	eb da                	jmp    80195b <write+0x59>
		return -E_NOT_SUPP;
  801981:	b8 f1 ff ff ff       	mov    $0xfffffff1,%eax
  801986:	eb d3                	jmp    80195b <write+0x59>

00801988 <seek>:

int
seek(int fdnum, off_t offset)
{
  801988:	f3 0f 1e fb          	endbr32 
  80198c:	55                   	push   %ebp
  80198d:	89 e5                	mov    %esp,%ebp
  80198f:	83 ec 20             	sub    $0x20,%esp
	int r;
	struct Fd *fd;

	if ((r = fd_lookup(fdnum, &fd)) < 0)
  801992:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801995:	50                   	push   %eax
  801996:	ff 75 08             	pushl  0x8(%ebp)
  801999:	e8 0b fc ff ff       	call   8015a9 <fd_lookup>
  80199e:	83 c4 10             	add    $0x10,%esp
  8019a1:	85 c0                	test   %eax,%eax
  8019a3:	78 0e                	js     8019b3 <seek+0x2b>
		return r;
	fd->fd_offset = offset;
  8019a5:	8b 55 0c             	mov    0xc(%ebp),%edx
  8019a8:	8b 45 f4             	mov    -0xc(%ebp),%eax
  8019ab:	89 50 04             	mov    %edx,0x4(%eax)
	return 0;
  8019ae:	b8 00 00 00 00       	mov    $0x0,%eax
}
  8019b3:	c9                   	leave  
  8019b4:	c3                   	ret    

008019b5 <ftruncate>:

int
ftruncate(int fdnum, off_t newsize)
{
  8019b5:	f3 0f 1e fb          	endbr32 
  8019b9:	55                   	push   %ebp
  8019ba:	89 e5                	mov    %esp,%ebp
  8019bc:	53                   	push   %ebx
  8019bd:	83 ec 1c             	sub    $0x1c,%esp
  8019c0:	8b 5d 08             	mov    0x8(%ebp),%ebx
	int r;
	struct Dev *dev;
	struct Fd *fd;
	if ((r = fd_lookup(fdnum, &fd)) < 0
  8019c3:	8d 45 f0             	lea    -0x10(%ebp),%eax
  8019c6:	50                   	push   %eax
  8019c7:	53                   	push   %ebx
  8019c8:	e8 dc fb ff ff       	call   8015a9 <fd_lookup>
  8019cd:	83 c4 10             	add    $0x10,%esp
  8019d0:	85 c0                	test   %eax,%eax
  8019d2:	78 37                	js     801a0b <ftruncate+0x56>
	    || (r = dev_lookup(fd->fd_dev_id, &dev)) < 0)
  8019d4:	83 ec 08             	sub    $0x8,%esp
  8019d7:	8d 45 f4             	lea    -0xc(%ebp),%eax
  8019da:	50                   	push   %eax
  8019db:	8b 45 f0             	mov    -0x10(%ebp),%eax
  8019de:	ff 30                	pushl  (%eax)
  8019e0:	e8 18 fc ff ff       	call   8015fd <dev_lookup>
  8019e5:	83 c4 10             	add    $0x10,%esp
  8019e8:	85 c0                	test   %eax,%eax
  8019ea:	78 1f                	js     801a0b <ftruncate+0x56>
		return r;
	if ((fd->fd_omode & O_ACCMODE) == O_RDONLY) {
  8019ec:	8b 45 f0             	mov    -0x10(%ebp),%eax
  8019ef:	f6 40 08 03          	testb  $0x3,0x8(%eax)
  8019f3:	74 1b                	je     801a10 <ftruncate+0x5b>
		cprintf("[%08x] ftruncate %d -- bad mode\n",
			thisenv->env_id, fdnum);
		return -E_INVAL;
	}
	if (!dev->dev_trunc)
  8019f5:	8b 55 f4             	mov    -0xc(%ebp),%edx
  8019f8:	8b 52 18             	mov    0x18(%edx),%edx
  8019fb:	85 d2                	test   %edx,%edx
  8019fd:	74 32                	je     801a31 <ftruncate+0x7c>
		return -E_NOT_SUPP;
	return (*dev->dev_trunc)(fd, newsize);
  8019ff:	83 ec 08             	sub    $0x8,%esp
  801a02:	ff 75 0c             	pushl  0xc(%ebp)
  801a05:	50                   	push   %eax
  801a06:	ff d2                	call   *%edx
  801a08:	83 c4 10             	add    $0x10,%esp
}
  801a0b:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  801a0e:	c9                   	leave  
  801a0f:	c3                   	ret    
			thisenv->env_id, fdnum);
  801a10:	a1 04 40 80 00       	mov    0x804004,%eax
		cprintf("[%08x] ftruncate %d -- bad mode\n",
  801a15:	8b 40 48             	mov    0x48(%eax),%eax
  801a18:	83 ec 04             	sub    $0x4,%esp
  801a1b:	53                   	push   %ebx
  801a1c:	50                   	push   %eax
  801a1d:	68 88 2c 80 00       	push   $0x802c88
  801a22:	e8 bb ed ff ff       	call   8007e2 <cprintf>
		return -E_INVAL;
  801a27:	83 c4 10             	add    $0x10,%esp
  801a2a:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  801a2f:	eb da                	jmp    801a0b <ftruncate+0x56>
		return -E_NOT_SUPP;
  801a31:	b8 f1 ff ff ff       	mov    $0xfffffff1,%eax
  801a36:	eb d3                	jmp    801a0b <ftruncate+0x56>

00801a38 <fstat>:

int
fstat(int fdnum, struct Stat *stat)
{
  801a38:	f3 0f 1e fb          	endbr32 
  801a3c:	55                   	push   %ebp
  801a3d:	89 e5                	mov    %esp,%ebp
  801a3f:	53                   	push   %ebx
  801a40:	83 ec 1c             	sub    $0x1c,%esp
  801a43:	8b 5d 0c             	mov    0xc(%ebp),%ebx
	int r;
	struct Dev *dev;
	struct Fd *fd;

	if ((r = fd_lookup(fdnum, &fd)) < 0
  801a46:	8d 45 f0             	lea    -0x10(%ebp),%eax
  801a49:	50                   	push   %eax
  801a4a:	ff 75 08             	pushl  0x8(%ebp)
  801a4d:	e8 57 fb ff ff       	call   8015a9 <fd_lookup>
  801a52:	83 c4 10             	add    $0x10,%esp
  801a55:	85 c0                	test   %eax,%eax
  801a57:	78 4b                	js     801aa4 <fstat+0x6c>
	    || (r = dev_lookup(fd->fd_dev_id, &dev)) < 0)
  801a59:	83 ec 08             	sub    $0x8,%esp
  801a5c:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801a5f:	50                   	push   %eax
  801a60:	8b 45 f0             	mov    -0x10(%ebp),%eax
  801a63:	ff 30                	pushl  (%eax)
  801a65:	e8 93 fb ff ff       	call   8015fd <dev_lookup>
  801a6a:	83 c4 10             	add    $0x10,%esp
  801a6d:	85 c0                	test   %eax,%eax
  801a6f:	78 33                	js     801aa4 <fstat+0x6c>
		return r;
	if (!dev->dev_stat)
  801a71:	8b 45 f4             	mov    -0xc(%ebp),%eax
  801a74:	83 78 14 00          	cmpl   $0x0,0x14(%eax)
  801a78:	74 2f                	je     801aa9 <fstat+0x71>
		return -E_NOT_SUPP;
	stat->st_name[0] = 0;
  801a7a:	c6 03 00             	movb   $0x0,(%ebx)
	stat->st_size = 0;
  801a7d:	c7 83 80 00 00 00 00 	movl   $0x0,0x80(%ebx)
  801a84:	00 00 00 
	stat->st_isdir = 0;
  801a87:	c7 83 84 00 00 00 00 	movl   $0x0,0x84(%ebx)
  801a8e:	00 00 00 
	stat->st_dev = dev;
  801a91:	89 83 88 00 00 00    	mov    %eax,0x88(%ebx)
	return (*dev->dev_stat)(fd, stat);
  801a97:	83 ec 08             	sub    $0x8,%esp
  801a9a:	53                   	push   %ebx
  801a9b:	ff 75 f0             	pushl  -0x10(%ebp)
  801a9e:	ff 50 14             	call   *0x14(%eax)
  801aa1:	83 c4 10             	add    $0x10,%esp
}
  801aa4:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  801aa7:	c9                   	leave  
  801aa8:	c3                   	ret    
		return -E_NOT_SUPP;
  801aa9:	b8 f1 ff ff ff       	mov    $0xfffffff1,%eax
  801aae:	eb f4                	jmp    801aa4 <fstat+0x6c>

00801ab0 <stat>:

int
stat(const char *path, struct Stat *stat)
{
  801ab0:	f3 0f 1e fb          	endbr32 
  801ab4:	55                   	push   %ebp
  801ab5:	89 e5                	mov    %esp,%ebp
  801ab7:	56                   	push   %esi
  801ab8:	53                   	push   %ebx
	int fd, r;

	if ((fd = open(path, O_RDONLY)) < 0)
  801ab9:	83 ec 08             	sub    $0x8,%esp
  801abc:	6a 00                	push   $0x0
  801abe:	ff 75 08             	pushl  0x8(%ebp)
  801ac1:	e8 fb 01 00 00       	call   801cc1 <open>
  801ac6:	89 c3                	mov    %eax,%ebx
  801ac8:	83 c4 10             	add    $0x10,%esp
  801acb:	85 c0                	test   %eax,%eax
  801acd:	78 1b                	js     801aea <stat+0x3a>
		return fd;
	r = fstat(fd, stat);
  801acf:	83 ec 08             	sub    $0x8,%esp
  801ad2:	ff 75 0c             	pushl  0xc(%ebp)
  801ad5:	50                   	push   %eax
  801ad6:	e8 5d ff ff ff       	call   801a38 <fstat>
  801adb:	89 c6                	mov    %eax,%esi
	close(fd);
  801add:	89 1c 24             	mov    %ebx,(%esp)
  801ae0:	e8 fd fb ff ff       	call   8016e2 <close>
	return r;
  801ae5:	83 c4 10             	add    $0x10,%esp
  801ae8:	89 f3                	mov    %esi,%ebx
}
  801aea:	89 d8                	mov    %ebx,%eax
  801aec:	8d 65 f8             	lea    -0x8(%ebp),%esp
  801aef:	5b                   	pop    %ebx
  801af0:	5e                   	pop    %esi
  801af1:	5d                   	pop    %ebp
  801af2:	c3                   	ret    

00801af3 <fsipc>:
// type: request code, passed as the simple integer IPC value.
// dstva: virtual address at which to receive reply page, 0 if none.
// Returns result from the file server.
static int
fsipc(unsigned type, void *dstva)
{
  801af3:	55                   	push   %ebp
  801af4:	89 e5                	mov    %esp,%ebp
  801af6:	56                   	push   %esi
  801af7:	53                   	push   %ebx
  801af8:	89 c6                	mov    %eax,%esi
  801afa:	89 d3                	mov    %edx,%ebx
	static envid_t fsenv;
	if (fsenv == 0)
  801afc:	83 3d 00 40 80 00 00 	cmpl   $0x0,0x804000
  801b03:	74 27                	je     801b2c <fsipc+0x39>
	static_assert(sizeof(fsipcbuf) == PGSIZE);

	if (debug)
		cprintf("[%08x] fsipc %d %08x\n", thisenv->env_id, type, *(uint32_t *)&fsipcbuf);

	ipc_send(fsenv, type, &fsipcbuf, PTE_P | PTE_W | PTE_U);
  801b05:	6a 07                	push   $0x7
  801b07:	68 00 50 80 00       	push   $0x805000
  801b0c:	56                   	push   %esi
  801b0d:	ff 35 00 40 80 00    	pushl  0x804000
  801b13:	e8 77 f9 ff ff       	call   80148f <ipc_send>
	return ipc_recv(NULL, dstva, NULL);
  801b18:	83 c4 0c             	add    $0xc,%esp
  801b1b:	6a 00                	push   $0x0
  801b1d:	53                   	push   %ebx
  801b1e:	6a 00                	push   $0x0
  801b20:	e8 e9 f8 ff ff       	call   80140e <ipc_recv>
}
  801b25:	8d 65 f8             	lea    -0x8(%ebp),%esp
  801b28:	5b                   	pop    %ebx
  801b29:	5e                   	pop    %esi
  801b2a:	5d                   	pop    %ebp
  801b2b:	c3                   	ret    
		fsenv = ipc_find_env(ENV_TYPE_FS);
  801b2c:	83 ec 0c             	sub    $0xc,%esp
  801b2f:	6a 01                	push   $0x1
  801b31:	e8 b1 f9 ff ff       	call   8014e7 <ipc_find_env>
  801b36:	a3 00 40 80 00       	mov    %eax,0x804000
  801b3b:	83 c4 10             	add    $0x10,%esp
  801b3e:	eb c5                	jmp    801b05 <fsipc+0x12>

00801b40 <devfile_trunc>:
}

// Truncate or extend an open file to 'size' bytes
static int
devfile_trunc(struct Fd *fd, off_t newsize)
{
  801b40:	f3 0f 1e fb          	endbr32 
  801b44:	55                   	push   %ebp
  801b45:	89 e5                	mov    %esp,%ebp
  801b47:	83 ec 08             	sub    $0x8,%esp
	fsipcbuf.set_size.req_fileid = fd->fd_file.id;
  801b4a:	8b 45 08             	mov    0x8(%ebp),%eax
  801b4d:	8b 40 0c             	mov    0xc(%eax),%eax
  801b50:	a3 00 50 80 00       	mov    %eax,0x805000
	fsipcbuf.set_size.req_size = newsize;
  801b55:	8b 45 0c             	mov    0xc(%ebp),%eax
  801b58:	a3 04 50 80 00       	mov    %eax,0x805004
	return fsipc(FSREQ_SET_SIZE, NULL);
  801b5d:	ba 00 00 00 00       	mov    $0x0,%edx
  801b62:	b8 02 00 00 00       	mov    $0x2,%eax
  801b67:	e8 87 ff ff ff       	call   801af3 <fsipc>
}
  801b6c:	c9                   	leave  
  801b6d:	c3                   	ret    

00801b6e <devfile_flush>:
{
  801b6e:	f3 0f 1e fb          	endbr32 
  801b72:	55                   	push   %ebp
  801b73:	89 e5                	mov    %esp,%ebp
  801b75:	83 ec 08             	sub    $0x8,%esp
	fsipcbuf.flush.req_fileid = fd->fd_file.id;
  801b78:	8b 45 08             	mov    0x8(%ebp),%eax
  801b7b:	8b 40 0c             	mov    0xc(%eax),%eax
  801b7e:	a3 00 50 80 00       	mov    %eax,0x805000
	return fsipc(FSREQ_FLUSH, NULL);
  801b83:	ba 00 00 00 00       	mov    $0x0,%edx
  801b88:	b8 06 00 00 00       	mov    $0x6,%eax
  801b8d:	e8 61 ff ff ff       	call   801af3 <fsipc>
}
  801b92:	c9                   	leave  
  801b93:	c3                   	ret    

00801b94 <devfile_stat>:
{
  801b94:	f3 0f 1e fb          	endbr32 
  801b98:	55                   	push   %ebp
  801b99:	89 e5                	mov    %esp,%ebp
  801b9b:	53                   	push   %ebx
  801b9c:	83 ec 04             	sub    $0x4,%esp
  801b9f:	8b 5d 0c             	mov    0xc(%ebp),%ebx
	fsipcbuf.stat.req_fileid = fd->fd_file.id;
  801ba2:	8b 45 08             	mov    0x8(%ebp),%eax
  801ba5:	8b 40 0c             	mov    0xc(%eax),%eax
  801ba8:	a3 00 50 80 00       	mov    %eax,0x805000
	if ((r = fsipc(FSREQ_STAT, NULL)) < 0)
  801bad:	ba 00 00 00 00       	mov    $0x0,%edx
  801bb2:	b8 05 00 00 00       	mov    $0x5,%eax
  801bb7:	e8 37 ff ff ff       	call   801af3 <fsipc>
  801bbc:	85 c0                	test   %eax,%eax
  801bbe:	78 2c                	js     801bec <devfile_stat+0x58>
	strcpy(st->st_name, fsipcbuf.statRet.ret_name);
  801bc0:	83 ec 08             	sub    $0x8,%esp
  801bc3:	68 00 50 80 00       	push   $0x805000
  801bc8:	53                   	push   %ebx
  801bc9:	e8 ed f1 ff ff       	call   800dbb <strcpy>
	st->st_size = fsipcbuf.statRet.ret_size;
  801bce:	a1 80 50 80 00       	mov    0x805080,%eax
  801bd3:	89 83 80 00 00 00    	mov    %eax,0x80(%ebx)
	st->st_isdir = fsipcbuf.statRet.ret_isdir;
  801bd9:	a1 84 50 80 00       	mov    0x805084,%eax
  801bde:	89 83 84 00 00 00    	mov    %eax,0x84(%ebx)
	return 0;
  801be4:	83 c4 10             	add    $0x10,%esp
  801be7:	b8 00 00 00 00       	mov    $0x0,%eax
}
  801bec:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  801bef:	c9                   	leave  
  801bf0:	c3                   	ret    

00801bf1 <devfile_write>:
{
  801bf1:	f3 0f 1e fb          	endbr32 
  801bf5:	55                   	push   %ebp
  801bf6:	89 e5                	mov    %esp,%ebp
  801bf8:	83 ec 0c             	sub    $0xc,%esp
  801bfb:	8b 45 10             	mov    0x10(%ebp),%eax
  801bfe:	3d f8 0f 00 00       	cmp    $0xff8,%eax
  801c03:	ba f8 0f 00 00       	mov    $0xff8,%edx
  801c08:	0f 47 c2             	cmova  %edx,%eax
	fsipcbuf.write.req_fileid = fd->fd_file.id;
  801c0b:	8b 55 08             	mov    0x8(%ebp),%edx
  801c0e:	8b 52 0c             	mov    0xc(%edx),%edx
  801c11:	89 15 00 50 80 00    	mov    %edx,0x805000
	fsipcbuf.write.req_n = n;
  801c17:	a3 04 50 80 00       	mov    %eax,0x805004
	memmove(fsipcbuf.write.req_buf, buf, n);
  801c1c:	50                   	push   %eax
  801c1d:	ff 75 0c             	pushl  0xc(%ebp)
  801c20:	68 08 50 80 00       	push   $0x805008
  801c25:	e8 47 f3 ff ff       	call   800f71 <memmove>
	return fsipc(FSREQ_WRITE, NULL);}
  801c2a:	ba 00 00 00 00       	mov    $0x0,%edx
  801c2f:	b8 04 00 00 00       	mov    $0x4,%eax
  801c34:	e8 ba fe ff ff       	call   801af3 <fsipc>
  801c39:	c9                   	leave  
  801c3a:	c3                   	ret    

00801c3b <devfile_read>:
{
  801c3b:	f3 0f 1e fb          	endbr32 
  801c3f:	55                   	push   %ebp
  801c40:	89 e5                	mov    %esp,%ebp
  801c42:	56                   	push   %esi
  801c43:	53                   	push   %ebx
  801c44:	8b 75 10             	mov    0x10(%ebp),%esi
	fsipcbuf.read.req_fileid = fd->fd_file.id;
  801c47:	8b 45 08             	mov    0x8(%ebp),%eax
  801c4a:	8b 40 0c             	mov    0xc(%eax),%eax
  801c4d:	a3 00 50 80 00       	mov    %eax,0x805000
	fsipcbuf.read.req_n = n;
  801c52:	89 35 04 50 80 00    	mov    %esi,0x805004
	if ((r = fsipc(FSREQ_READ, NULL)) < 0)
  801c58:	ba 00 00 00 00       	mov    $0x0,%edx
  801c5d:	b8 03 00 00 00       	mov    $0x3,%eax
  801c62:	e8 8c fe ff ff       	call   801af3 <fsipc>
  801c67:	89 c3                	mov    %eax,%ebx
  801c69:	85 c0                	test   %eax,%eax
  801c6b:	78 1f                	js     801c8c <devfile_read+0x51>
	assert(r <= n);
  801c6d:	39 f0                	cmp    %esi,%eax
  801c6f:	77 24                	ja     801c95 <devfile_read+0x5a>
	assert(r <= PGSIZE);
  801c71:	3d 00 10 00 00       	cmp    $0x1000,%eax
  801c76:	7f 33                	jg     801cab <devfile_read+0x70>
	memmove(buf, fsipcbuf.readRet.ret_buf, r);
  801c78:	83 ec 04             	sub    $0x4,%esp
  801c7b:	50                   	push   %eax
  801c7c:	68 00 50 80 00       	push   $0x805000
  801c81:	ff 75 0c             	pushl  0xc(%ebp)
  801c84:	e8 e8 f2 ff ff       	call   800f71 <memmove>
	return r;
  801c89:	83 c4 10             	add    $0x10,%esp
}
  801c8c:	89 d8                	mov    %ebx,%eax
  801c8e:	8d 65 f8             	lea    -0x8(%ebp),%esp
  801c91:	5b                   	pop    %ebx
  801c92:	5e                   	pop    %esi
  801c93:	5d                   	pop    %ebp
  801c94:	c3                   	ret    
	assert(r <= n);
  801c95:	68 f4 2c 80 00       	push   $0x802cf4
  801c9a:	68 fb 2c 80 00       	push   $0x802cfb
  801c9f:	6a 7c                	push   $0x7c
  801ca1:	68 10 2d 80 00       	push   $0x802d10
  801ca6:	e8 50 ea ff ff       	call   8006fb <_panic>
	assert(r <= PGSIZE);
  801cab:	68 1b 2d 80 00       	push   $0x802d1b
  801cb0:	68 fb 2c 80 00       	push   $0x802cfb
  801cb5:	6a 7d                	push   $0x7d
  801cb7:	68 10 2d 80 00       	push   $0x802d10
  801cbc:	e8 3a ea ff ff       	call   8006fb <_panic>

00801cc1 <open>:
{
  801cc1:	f3 0f 1e fb          	endbr32 
  801cc5:	55                   	push   %ebp
  801cc6:	89 e5                	mov    %esp,%ebp
  801cc8:	56                   	push   %esi
  801cc9:	53                   	push   %ebx
  801cca:	83 ec 1c             	sub    $0x1c,%esp
  801ccd:	8b 75 08             	mov    0x8(%ebp),%esi
	if (strlen(path) >= MAXPATHLEN)
  801cd0:	56                   	push   %esi
  801cd1:	e8 a2 f0 ff ff       	call   800d78 <strlen>
  801cd6:	83 c4 10             	add    $0x10,%esp
  801cd9:	3d ff 03 00 00       	cmp    $0x3ff,%eax
  801cde:	7f 6c                	jg     801d4c <open+0x8b>
	if ((r = fd_alloc(&fd)) < 0)
  801ce0:	83 ec 0c             	sub    $0xc,%esp
  801ce3:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801ce6:	50                   	push   %eax
  801ce7:	e8 67 f8 ff ff       	call   801553 <fd_alloc>
  801cec:	89 c3                	mov    %eax,%ebx
  801cee:	83 c4 10             	add    $0x10,%esp
  801cf1:	85 c0                	test   %eax,%eax
  801cf3:	78 3c                	js     801d31 <open+0x70>
	strcpy(fsipcbuf.open.req_path, path);
  801cf5:	83 ec 08             	sub    $0x8,%esp
  801cf8:	56                   	push   %esi
  801cf9:	68 00 50 80 00       	push   $0x805000
  801cfe:	e8 b8 f0 ff ff       	call   800dbb <strcpy>
	fsipcbuf.open.req_omode = mode;
  801d03:	8b 45 0c             	mov    0xc(%ebp),%eax
  801d06:	a3 00 54 80 00       	mov    %eax,0x805400
	if ((r = fsipc(FSREQ_OPEN, fd)) < 0) {
  801d0b:	8b 55 f4             	mov    -0xc(%ebp),%edx
  801d0e:	b8 01 00 00 00       	mov    $0x1,%eax
  801d13:	e8 db fd ff ff       	call   801af3 <fsipc>
  801d18:	89 c3                	mov    %eax,%ebx
  801d1a:	83 c4 10             	add    $0x10,%esp
  801d1d:	85 c0                	test   %eax,%eax
  801d1f:	78 19                	js     801d3a <open+0x79>
	return fd2num(fd);
  801d21:	83 ec 0c             	sub    $0xc,%esp
  801d24:	ff 75 f4             	pushl  -0xc(%ebp)
  801d27:	e8 f8 f7 ff ff       	call   801524 <fd2num>
  801d2c:	89 c3                	mov    %eax,%ebx
  801d2e:	83 c4 10             	add    $0x10,%esp
}
  801d31:	89 d8                	mov    %ebx,%eax
  801d33:	8d 65 f8             	lea    -0x8(%ebp),%esp
  801d36:	5b                   	pop    %ebx
  801d37:	5e                   	pop    %esi
  801d38:	5d                   	pop    %ebp
  801d39:	c3                   	ret    
		fd_close(fd, 0);
  801d3a:	83 ec 08             	sub    $0x8,%esp
  801d3d:	6a 00                	push   $0x0
  801d3f:	ff 75 f4             	pushl  -0xc(%ebp)
  801d42:	e8 10 f9 ff ff       	call   801657 <fd_close>
		return r;
  801d47:	83 c4 10             	add    $0x10,%esp
  801d4a:	eb e5                	jmp    801d31 <open+0x70>
		return -E_BAD_PATH;
  801d4c:	bb f4 ff ff ff       	mov    $0xfffffff4,%ebx
  801d51:	eb de                	jmp    801d31 <open+0x70>

00801d53 <sync>:


// Synchronize disk with buffer cache
int
sync(void)
{
  801d53:	f3 0f 1e fb          	endbr32 
  801d57:	55                   	push   %ebp
  801d58:	89 e5                	mov    %esp,%ebp
  801d5a:	83 ec 08             	sub    $0x8,%esp
	// Ask the file server to update the disk
	// by writing any dirty blocks in the buffer cache.

	return fsipc(FSREQ_SYNC, NULL);
  801d5d:	ba 00 00 00 00       	mov    $0x0,%edx
  801d62:	b8 08 00 00 00       	mov    $0x8,%eax
  801d67:	e8 87 fd ff ff       	call   801af3 <fsipc>
}
  801d6c:	c9                   	leave  
  801d6d:	c3                   	ret    

00801d6e <devpipe_stat>:
	return i;
}

static int
devpipe_stat(struct Fd *fd, struct Stat *stat)
{
  801d6e:	f3 0f 1e fb          	endbr32 
  801d72:	55                   	push   %ebp
  801d73:	89 e5                	mov    %esp,%ebp
  801d75:	56                   	push   %esi
  801d76:	53                   	push   %ebx
  801d77:	8b 5d 0c             	mov    0xc(%ebp),%ebx
	struct Pipe *p = (struct Pipe*) fd2data(fd);
  801d7a:	83 ec 0c             	sub    $0xc,%esp
  801d7d:	ff 75 08             	pushl  0x8(%ebp)
  801d80:	e8 b3 f7 ff ff       	call   801538 <fd2data>
  801d85:	89 c6                	mov    %eax,%esi
	strcpy(stat->st_name, "<pipe>");
  801d87:	83 c4 08             	add    $0x8,%esp
  801d8a:	68 27 2d 80 00       	push   $0x802d27
  801d8f:	53                   	push   %ebx
  801d90:	e8 26 f0 ff ff       	call   800dbb <strcpy>
	stat->st_size = p->p_wpos - p->p_rpos;
  801d95:	8b 46 04             	mov    0x4(%esi),%eax
  801d98:	2b 06                	sub    (%esi),%eax
  801d9a:	89 83 80 00 00 00    	mov    %eax,0x80(%ebx)
	stat->st_isdir = 0;
  801da0:	c7 83 84 00 00 00 00 	movl   $0x0,0x84(%ebx)
  801da7:	00 00 00 
	stat->st_dev = &devpipe;
  801daa:	c7 83 88 00 00 00 24 	movl   $0x803024,0x88(%ebx)
  801db1:	30 80 00 
	return 0;
}
  801db4:	b8 00 00 00 00       	mov    $0x0,%eax
  801db9:	8d 65 f8             	lea    -0x8(%ebp),%esp
  801dbc:	5b                   	pop    %ebx
  801dbd:	5e                   	pop    %esi
  801dbe:	5d                   	pop    %ebp
  801dbf:	c3                   	ret    

00801dc0 <devpipe_close>:

static int
devpipe_close(struct Fd *fd)
{
  801dc0:	f3 0f 1e fb          	endbr32 
  801dc4:	55                   	push   %ebp
  801dc5:	89 e5                	mov    %esp,%ebp
  801dc7:	53                   	push   %ebx
  801dc8:	83 ec 0c             	sub    $0xc,%esp
  801dcb:	8b 5d 08             	mov    0x8(%ebp),%ebx
	(void) sys_page_unmap(0, fd);
  801dce:	53                   	push   %ebx
  801dcf:	6a 00                	push   $0x0
  801dd1:	e8 b4 f4 ff ff       	call   80128a <sys_page_unmap>
	return sys_page_unmap(0, fd2data(fd));
  801dd6:	89 1c 24             	mov    %ebx,(%esp)
  801dd9:	e8 5a f7 ff ff       	call   801538 <fd2data>
  801dde:	83 c4 08             	add    $0x8,%esp
  801de1:	50                   	push   %eax
  801de2:	6a 00                	push   $0x0
  801de4:	e8 a1 f4 ff ff       	call   80128a <sys_page_unmap>
}
  801de9:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  801dec:	c9                   	leave  
  801ded:	c3                   	ret    

00801dee <_pipeisclosed>:
{
  801dee:	55                   	push   %ebp
  801def:	89 e5                	mov    %esp,%ebp
  801df1:	57                   	push   %edi
  801df2:	56                   	push   %esi
  801df3:	53                   	push   %ebx
  801df4:	83 ec 1c             	sub    $0x1c,%esp
  801df7:	89 c7                	mov    %eax,%edi
  801df9:	89 d6                	mov    %edx,%esi
		n = thisenv->env_runs;
  801dfb:	a1 04 40 80 00       	mov    0x804004,%eax
  801e00:	8b 58 58             	mov    0x58(%eax),%ebx
		ret = pageref(fd) == pageref(p);
  801e03:	83 ec 0c             	sub    $0xc,%esp
  801e06:	57                   	push   %edi
  801e07:	e8 5d 04 00 00       	call   802269 <pageref>
  801e0c:	89 45 e4             	mov    %eax,-0x1c(%ebp)
  801e0f:	89 34 24             	mov    %esi,(%esp)
  801e12:	e8 52 04 00 00       	call   802269 <pageref>
		nn = thisenv->env_runs;
  801e17:	8b 15 04 40 80 00    	mov    0x804004,%edx
  801e1d:	8b 4a 58             	mov    0x58(%edx),%ecx
		if (n == nn)
  801e20:	83 c4 10             	add    $0x10,%esp
  801e23:	39 cb                	cmp    %ecx,%ebx
  801e25:	74 1b                	je     801e42 <_pipeisclosed+0x54>
		if (n != nn && ret == 1)
  801e27:	39 45 e4             	cmp    %eax,-0x1c(%ebp)
  801e2a:	75 cf                	jne    801dfb <_pipeisclosed+0xd>
			cprintf("pipe race avoided\n", n, thisenv->env_runs, ret);
  801e2c:	8b 42 58             	mov    0x58(%edx),%eax
  801e2f:	6a 01                	push   $0x1
  801e31:	50                   	push   %eax
  801e32:	53                   	push   %ebx
  801e33:	68 2e 2d 80 00       	push   $0x802d2e
  801e38:	e8 a5 e9 ff ff       	call   8007e2 <cprintf>
  801e3d:	83 c4 10             	add    $0x10,%esp
  801e40:	eb b9                	jmp    801dfb <_pipeisclosed+0xd>
		ret = pageref(fd) == pageref(p);
  801e42:	39 45 e4             	cmp    %eax,-0x1c(%ebp)
  801e45:	0f 94 c0             	sete   %al
  801e48:	0f b6 c0             	movzbl %al,%eax
}
  801e4b:	8d 65 f4             	lea    -0xc(%ebp),%esp
  801e4e:	5b                   	pop    %ebx
  801e4f:	5e                   	pop    %esi
  801e50:	5f                   	pop    %edi
  801e51:	5d                   	pop    %ebp
  801e52:	c3                   	ret    

00801e53 <devpipe_write>:
{
  801e53:	f3 0f 1e fb          	endbr32 
  801e57:	55                   	push   %ebp
  801e58:	89 e5                	mov    %esp,%ebp
  801e5a:	57                   	push   %edi
  801e5b:	56                   	push   %esi
  801e5c:	53                   	push   %ebx
  801e5d:	83 ec 28             	sub    $0x28,%esp
  801e60:	8b 75 08             	mov    0x8(%ebp),%esi
	p = (struct Pipe*) fd2data(fd);
  801e63:	56                   	push   %esi
  801e64:	e8 cf f6 ff ff       	call   801538 <fd2data>
  801e69:	89 c3                	mov    %eax,%ebx
	for (i = 0; i < n; i++) {
  801e6b:	83 c4 10             	add    $0x10,%esp
  801e6e:	bf 00 00 00 00       	mov    $0x0,%edi
  801e73:	3b 7d 10             	cmp    0x10(%ebp),%edi
  801e76:	74 4f                	je     801ec7 <devpipe_write+0x74>
		while (p->p_wpos >= p->p_rpos + sizeof(p->p_buf)) {
  801e78:	8b 43 04             	mov    0x4(%ebx),%eax
  801e7b:	8b 0b                	mov    (%ebx),%ecx
  801e7d:	8d 51 20             	lea    0x20(%ecx),%edx
  801e80:	39 d0                	cmp    %edx,%eax
  801e82:	72 14                	jb     801e98 <devpipe_write+0x45>
			if (_pipeisclosed(fd, p))
  801e84:	89 da                	mov    %ebx,%edx
  801e86:	89 f0                	mov    %esi,%eax
  801e88:	e8 61 ff ff ff       	call   801dee <_pipeisclosed>
  801e8d:	85 c0                	test   %eax,%eax
  801e8f:	75 3b                	jne    801ecc <devpipe_write+0x79>
			sys_yield();
  801e91:	e8 44 f3 ff ff       	call   8011da <sys_yield>
  801e96:	eb e0                	jmp    801e78 <devpipe_write+0x25>
		p->p_buf[p->p_wpos % PIPEBUFSIZ] = buf[i];
  801e98:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  801e9b:	0f b6 0c 39          	movzbl (%ecx,%edi,1),%ecx
  801e9f:	88 4d e7             	mov    %cl,-0x19(%ebp)
  801ea2:	89 c2                	mov    %eax,%edx
  801ea4:	c1 fa 1f             	sar    $0x1f,%edx
  801ea7:	89 d1                	mov    %edx,%ecx
  801ea9:	c1 e9 1b             	shr    $0x1b,%ecx
  801eac:	8d 14 08             	lea    (%eax,%ecx,1),%edx
  801eaf:	83 e2 1f             	and    $0x1f,%edx
  801eb2:	29 ca                	sub    %ecx,%edx
  801eb4:	0f b6 4d e7          	movzbl -0x19(%ebp),%ecx
  801eb8:	88 4c 13 08          	mov    %cl,0x8(%ebx,%edx,1)
		p->p_wpos++;
  801ebc:	83 c0 01             	add    $0x1,%eax
  801ebf:	89 43 04             	mov    %eax,0x4(%ebx)
	for (i = 0; i < n; i++) {
  801ec2:	83 c7 01             	add    $0x1,%edi
  801ec5:	eb ac                	jmp    801e73 <devpipe_write+0x20>
	return i;
  801ec7:	8b 45 10             	mov    0x10(%ebp),%eax
  801eca:	eb 05                	jmp    801ed1 <devpipe_write+0x7e>
				return 0;
  801ecc:	b8 00 00 00 00       	mov    $0x0,%eax
}
  801ed1:	8d 65 f4             	lea    -0xc(%ebp),%esp
  801ed4:	5b                   	pop    %ebx
  801ed5:	5e                   	pop    %esi
  801ed6:	5f                   	pop    %edi
  801ed7:	5d                   	pop    %ebp
  801ed8:	c3                   	ret    

00801ed9 <devpipe_read>:
{
  801ed9:	f3 0f 1e fb          	endbr32 
  801edd:	55                   	push   %ebp
  801ede:	89 e5                	mov    %esp,%ebp
  801ee0:	57                   	push   %edi
  801ee1:	56                   	push   %esi
  801ee2:	53                   	push   %ebx
  801ee3:	83 ec 18             	sub    $0x18,%esp
  801ee6:	8b 7d 08             	mov    0x8(%ebp),%edi
	p = (struct Pipe*)fd2data(fd);
  801ee9:	57                   	push   %edi
  801eea:	e8 49 f6 ff ff       	call   801538 <fd2data>
  801eef:	89 c3                	mov    %eax,%ebx
	for (i = 0; i < n; i++) {
  801ef1:	83 c4 10             	add    $0x10,%esp
  801ef4:	be 00 00 00 00       	mov    $0x0,%esi
  801ef9:	3b 75 10             	cmp    0x10(%ebp),%esi
  801efc:	75 14                	jne    801f12 <devpipe_read+0x39>
	return i;
  801efe:	8b 45 10             	mov    0x10(%ebp),%eax
  801f01:	eb 02                	jmp    801f05 <devpipe_read+0x2c>
				return i;
  801f03:	89 f0                	mov    %esi,%eax
}
  801f05:	8d 65 f4             	lea    -0xc(%ebp),%esp
  801f08:	5b                   	pop    %ebx
  801f09:	5e                   	pop    %esi
  801f0a:	5f                   	pop    %edi
  801f0b:	5d                   	pop    %ebp
  801f0c:	c3                   	ret    
			sys_yield();
  801f0d:	e8 c8 f2 ff ff       	call   8011da <sys_yield>
		while (p->p_rpos == p->p_wpos) {
  801f12:	8b 03                	mov    (%ebx),%eax
  801f14:	3b 43 04             	cmp    0x4(%ebx),%eax
  801f17:	75 18                	jne    801f31 <devpipe_read+0x58>
			if (i > 0)
  801f19:	85 f6                	test   %esi,%esi
  801f1b:	75 e6                	jne    801f03 <devpipe_read+0x2a>
			if (_pipeisclosed(fd, p))
  801f1d:	89 da                	mov    %ebx,%edx
  801f1f:	89 f8                	mov    %edi,%eax
  801f21:	e8 c8 fe ff ff       	call   801dee <_pipeisclosed>
  801f26:	85 c0                	test   %eax,%eax
  801f28:	74 e3                	je     801f0d <devpipe_read+0x34>
				return 0;
  801f2a:	b8 00 00 00 00       	mov    $0x0,%eax
  801f2f:	eb d4                	jmp    801f05 <devpipe_read+0x2c>
		buf[i] = p->p_buf[p->p_rpos % PIPEBUFSIZ];
  801f31:	99                   	cltd   
  801f32:	c1 ea 1b             	shr    $0x1b,%edx
  801f35:	01 d0                	add    %edx,%eax
  801f37:	83 e0 1f             	and    $0x1f,%eax
  801f3a:	29 d0                	sub    %edx,%eax
  801f3c:	0f b6 44 03 08       	movzbl 0x8(%ebx,%eax,1),%eax
  801f41:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  801f44:	88 04 31             	mov    %al,(%ecx,%esi,1)
		p->p_rpos++;
  801f47:	83 03 01             	addl   $0x1,(%ebx)
	for (i = 0; i < n; i++) {
  801f4a:	83 c6 01             	add    $0x1,%esi
  801f4d:	eb aa                	jmp    801ef9 <devpipe_read+0x20>

00801f4f <pipe>:
{
  801f4f:	f3 0f 1e fb          	endbr32 
  801f53:	55                   	push   %ebp
  801f54:	89 e5                	mov    %esp,%ebp
  801f56:	56                   	push   %esi
  801f57:	53                   	push   %ebx
  801f58:	83 ec 1c             	sub    $0x1c,%esp
	if ((r = fd_alloc(&fd0)) < 0
  801f5b:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801f5e:	50                   	push   %eax
  801f5f:	e8 ef f5 ff ff       	call   801553 <fd_alloc>
  801f64:	89 c3                	mov    %eax,%ebx
  801f66:	83 c4 10             	add    $0x10,%esp
  801f69:	85 c0                	test   %eax,%eax
  801f6b:	0f 88 23 01 00 00    	js     802094 <pipe+0x145>
	    || (r = sys_page_alloc(0, fd0, PTE_P|PTE_W|PTE_U|PTE_SHARE)) < 0)
  801f71:	83 ec 04             	sub    $0x4,%esp
  801f74:	68 07 04 00 00       	push   $0x407
  801f79:	ff 75 f4             	pushl  -0xc(%ebp)
  801f7c:	6a 00                	push   $0x0
  801f7e:	e8 7a f2 ff ff       	call   8011fd <sys_page_alloc>
  801f83:	89 c3                	mov    %eax,%ebx
  801f85:	83 c4 10             	add    $0x10,%esp
  801f88:	85 c0                	test   %eax,%eax
  801f8a:	0f 88 04 01 00 00    	js     802094 <pipe+0x145>
	if ((r = fd_alloc(&fd1)) < 0
  801f90:	83 ec 0c             	sub    $0xc,%esp
  801f93:	8d 45 f0             	lea    -0x10(%ebp),%eax
  801f96:	50                   	push   %eax
  801f97:	e8 b7 f5 ff ff       	call   801553 <fd_alloc>
  801f9c:	89 c3                	mov    %eax,%ebx
  801f9e:	83 c4 10             	add    $0x10,%esp
  801fa1:	85 c0                	test   %eax,%eax
  801fa3:	0f 88 db 00 00 00    	js     802084 <pipe+0x135>
	    || (r = sys_page_alloc(0, fd1, PTE_P|PTE_W|PTE_U|PTE_SHARE)) < 0)
  801fa9:	83 ec 04             	sub    $0x4,%esp
  801fac:	68 07 04 00 00       	push   $0x407
  801fb1:	ff 75 f0             	pushl  -0x10(%ebp)
  801fb4:	6a 00                	push   $0x0
  801fb6:	e8 42 f2 ff ff       	call   8011fd <sys_page_alloc>
  801fbb:	89 c3                	mov    %eax,%ebx
  801fbd:	83 c4 10             	add    $0x10,%esp
  801fc0:	85 c0                	test   %eax,%eax
  801fc2:	0f 88 bc 00 00 00    	js     802084 <pipe+0x135>
	va = fd2data(fd0);
  801fc8:	83 ec 0c             	sub    $0xc,%esp
  801fcb:	ff 75 f4             	pushl  -0xc(%ebp)
  801fce:	e8 65 f5 ff ff       	call   801538 <fd2data>
  801fd3:	89 c6                	mov    %eax,%esi
	if ((r = sys_page_alloc(0, va, PTE_P|PTE_W|PTE_U|PTE_SHARE)) < 0)
  801fd5:	83 c4 0c             	add    $0xc,%esp
  801fd8:	68 07 04 00 00       	push   $0x407
  801fdd:	50                   	push   %eax
  801fde:	6a 00                	push   $0x0
  801fe0:	e8 18 f2 ff ff       	call   8011fd <sys_page_alloc>
  801fe5:	89 c3                	mov    %eax,%ebx
  801fe7:	83 c4 10             	add    $0x10,%esp
  801fea:	85 c0                	test   %eax,%eax
  801fec:	0f 88 82 00 00 00    	js     802074 <pipe+0x125>
	if ((r = sys_page_map(0, va, 0, fd2data(fd1), PTE_P|PTE_W|PTE_U|PTE_SHARE)) < 0)
  801ff2:	83 ec 0c             	sub    $0xc,%esp
  801ff5:	ff 75 f0             	pushl  -0x10(%ebp)
  801ff8:	e8 3b f5 ff ff       	call   801538 <fd2data>
  801ffd:	c7 04 24 07 04 00 00 	movl   $0x407,(%esp)
  802004:	50                   	push   %eax
  802005:	6a 00                	push   $0x0
  802007:	56                   	push   %esi
  802008:	6a 00                	push   $0x0
  80200a:	e8 35 f2 ff ff       	call   801244 <sys_page_map>
  80200f:	89 c3                	mov    %eax,%ebx
  802011:	83 c4 20             	add    $0x20,%esp
  802014:	85 c0                	test   %eax,%eax
  802016:	78 4e                	js     802066 <pipe+0x117>
	fd0->fd_dev_id = devpipe.dev_id;
  802018:	a1 24 30 80 00       	mov    0x803024,%eax
  80201d:	8b 55 f4             	mov    -0xc(%ebp),%edx
  802020:	89 02                	mov    %eax,(%edx)
	fd0->fd_omode = O_RDONLY;
  802022:	8b 55 f4             	mov    -0xc(%ebp),%edx
  802025:	c7 42 08 00 00 00 00 	movl   $0x0,0x8(%edx)
	fd1->fd_dev_id = devpipe.dev_id;
  80202c:	8b 55 f0             	mov    -0x10(%ebp),%edx
  80202f:	89 02                	mov    %eax,(%edx)
	fd1->fd_omode = O_WRONLY;
  802031:	8b 45 f0             	mov    -0x10(%ebp),%eax
  802034:	c7 40 08 01 00 00 00 	movl   $0x1,0x8(%eax)
	pfd[0] = fd2num(fd0);
  80203b:	83 ec 0c             	sub    $0xc,%esp
  80203e:	ff 75 f4             	pushl  -0xc(%ebp)
  802041:	e8 de f4 ff ff       	call   801524 <fd2num>
  802046:	8b 4d 08             	mov    0x8(%ebp),%ecx
  802049:	89 01                	mov    %eax,(%ecx)
	pfd[1] = fd2num(fd1);
  80204b:	83 c4 04             	add    $0x4,%esp
  80204e:	ff 75 f0             	pushl  -0x10(%ebp)
  802051:	e8 ce f4 ff ff       	call   801524 <fd2num>
  802056:	8b 4d 08             	mov    0x8(%ebp),%ecx
  802059:	89 41 04             	mov    %eax,0x4(%ecx)
	return 0;
  80205c:	83 c4 10             	add    $0x10,%esp
  80205f:	bb 00 00 00 00       	mov    $0x0,%ebx
  802064:	eb 2e                	jmp    802094 <pipe+0x145>
	sys_page_unmap(0, va);
  802066:	83 ec 08             	sub    $0x8,%esp
  802069:	56                   	push   %esi
  80206a:	6a 00                	push   $0x0
  80206c:	e8 19 f2 ff ff       	call   80128a <sys_page_unmap>
  802071:	83 c4 10             	add    $0x10,%esp
	sys_page_unmap(0, fd1);
  802074:	83 ec 08             	sub    $0x8,%esp
  802077:	ff 75 f0             	pushl  -0x10(%ebp)
  80207a:	6a 00                	push   $0x0
  80207c:	e8 09 f2 ff ff       	call   80128a <sys_page_unmap>
  802081:	83 c4 10             	add    $0x10,%esp
	sys_page_unmap(0, fd0);
  802084:	83 ec 08             	sub    $0x8,%esp
  802087:	ff 75 f4             	pushl  -0xc(%ebp)
  80208a:	6a 00                	push   $0x0
  80208c:	e8 f9 f1 ff ff       	call   80128a <sys_page_unmap>
  802091:	83 c4 10             	add    $0x10,%esp
}
  802094:	89 d8                	mov    %ebx,%eax
  802096:	8d 65 f8             	lea    -0x8(%ebp),%esp
  802099:	5b                   	pop    %ebx
  80209a:	5e                   	pop    %esi
  80209b:	5d                   	pop    %ebp
  80209c:	c3                   	ret    

0080209d <pipeisclosed>:
{
  80209d:	f3 0f 1e fb          	endbr32 
  8020a1:	55                   	push   %ebp
  8020a2:	89 e5                	mov    %esp,%ebp
  8020a4:	83 ec 20             	sub    $0x20,%esp
	if ((r = fd_lookup(fdnum, &fd)) < 0)
  8020a7:	8d 45 f4             	lea    -0xc(%ebp),%eax
  8020aa:	50                   	push   %eax
  8020ab:	ff 75 08             	pushl  0x8(%ebp)
  8020ae:	e8 f6 f4 ff ff       	call   8015a9 <fd_lookup>
  8020b3:	83 c4 10             	add    $0x10,%esp
  8020b6:	85 c0                	test   %eax,%eax
  8020b8:	78 18                	js     8020d2 <pipeisclosed+0x35>
	p = (struct Pipe*) fd2data(fd);
  8020ba:	83 ec 0c             	sub    $0xc,%esp
  8020bd:	ff 75 f4             	pushl  -0xc(%ebp)
  8020c0:	e8 73 f4 ff ff       	call   801538 <fd2data>
  8020c5:	89 c2                	mov    %eax,%edx
	return _pipeisclosed(fd, p);
  8020c7:	8b 45 f4             	mov    -0xc(%ebp),%eax
  8020ca:	e8 1f fd ff ff       	call   801dee <_pipeisclosed>
  8020cf:	83 c4 10             	add    $0x10,%esp
}
  8020d2:	c9                   	leave  
  8020d3:	c3                   	ret    

008020d4 <devcons_close>:
	return tot;
}

static int
devcons_close(struct Fd *fd)
{
  8020d4:	f3 0f 1e fb          	endbr32 
	USED(fd);

	return 0;
}
  8020d8:	b8 00 00 00 00       	mov    $0x0,%eax
  8020dd:	c3                   	ret    

008020de <devcons_stat>:

static int
devcons_stat(struct Fd *fd, struct Stat *stat)
{
  8020de:	f3 0f 1e fb          	endbr32 
  8020e2:	55                   	push   %ebp
  8020e3:	89 e5                	mov    %esp,%ebp
  8020e5:	83 ec 10             	sub    $0x10,%esp
	strcpy(stat->st_name, "<cons>");
  8020e8:	68 46 2d 80 00       	push   $0x802d46
  8020ed:	ff 75 0c             	pushl  0xc(%ebp)
  8020f0:	e8 c6 ec ff ff       	call   800dbb <strcpy>
	return 0;
}
  8020f5:	b8 00 00 00 00       	mov    $0x0,%eax
  8020fa:	c9                   	leave  
  8020fb:	c3                   	ret    

008020fc <devcons_write>:
{
  8020fc:	f3 0f 1e fb          	endbr32 
  802100:	55                   	push   %ebp
  802101:	89 e5                	mov    %esp,%ebp
  802103:	57                   	push   %edi
  802104:	56                   	push   %esi
  802105:	53                   	push   %ebx
  802106:	81 ec 8c 00 00 00    	sub    $0x8c,%esp
	for (tot = 0; tot < n; tot += m) {
  80210c:	be 00 00 00 00       	mov    $0x0,%esi
		memmove(buf, (char*)vbuf + tot, m);
  802111:	8d bd 68 ff ff ff    	lea    -0x98(%ebp),%edi
	for (tot = 0; tot < n; tot += m) {
  802117:	3b 75 10             	cmp    0x10(%ebp),%esi
  80211a:	73 31                	jae    80214d <devcons_write+0x51>
		m = n - tot;
  80211c:	8b 5d 10             	mov    0x10(%ebp),%ebx
  80211f:	29 f3                	sub    %esi,%ebx
  802121:	83 fb 7f             	cmp    $0x7f,%ebx
  802124:	b8 7f 00 00 00       	mov    $0x7f,%eax
  802129:	0f 47 d8             	cmova  %eax,%ebx
		memmove(buf, (char*)vbuf + tot, m);
  80212c:	83 ec 04             	sub    $0x4,%esp
  80212f:	53                   	push   %ebx
  802130:	89 f0                	mov    %esi,%eax
  802132:	03 45 0c             	add    0xc(%ebp),%eax
  802135:	50                   	push   %eax
  802136:	57                   	push   %edi
  802137:	e8 35 ee ff ff       	call   800f71 <memmove>
		sys_cputs(buf, m);
  80213c:	83 c4 08             	add    $0x8,%esp
  80213f:	53                   	push   %ebx
  802140:	57                   	push   %edi
  802141:	e8 e7 ef ff ff       	call   80112d <sys_cputs>
	for (tot = 0; tot < n; tot += m) {
  802146:	01 de                	add    %ebx,%esi
  802148:	83 c4 10             	add    $0x10,%esp
  80214b:	eb ca                	jmp    802117 <devcons_write+0x1b>
}
  80214d:	89 f0                	mov    %esi,%eax
  80214f:	8d 65 f4             	lea    -0xc(%ebp),%esp
  802152:	5b                   	pop    %ebx
  802153:	5e                   	pop    %esi
  802154:	5f                   	pop    %edi
  802155:	5d                   	pop    %ebp
  802156:	c3                   	ret    

00802157 <devcons_read>:
{
  802157:	f3 0f 1e fb          	endbr32 
  80215b:	55                   	push   %ebp
  80215c:	89 e5                	mov    %esp,%ebp
  80215e:	83 ec 08             	sub    $0x8,%esp
  802161:	b8 00 00 00 00       	mov    $0x0,%eax
	if (n == 0)
  802166:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
  80216a:	74 21                	je     80218d <devcons_read+0x36>
	while ((c = sys_cgetc()) == 0)
  80216c:	e8 de ef ff ff       	call   80114f <sys_cgetc>
  802171:	85 c0                	test   %eax,%eax
  802173:	75 07                	jne    80217c <devcons_read+0x25>
		sys_yield();
  802175:	e8 60 f0 ff ff       	call   8011da <sys_yield>
  80217a:	eb f0                	jmp    80216c <devcons_read+0x15>
	if (c < 0)
  80217c:	78 0f                	js     80218d <devcons_read+0x36>
	if (c == 0x04)	// ctl-d is eof
  80217e:	83 f8 04             	cmp    $0x4,%eax
  802181:	74 0c                	je     80218f <devcons_read+0x38>
	*(char*)vbuf = c;
  802183:	8b 55 0c             	mov    0xc(%ebp),%edx
  802186:	88 02                	mov    %al,(%edx)
	return 1;
  802188:	b8 01 00 00 00       	mov    $0x1,%eax
}
  80218d:	c9                   	leave  
  80218e:	c3                   	ret    
		return 0;
  80218f:	b8 00 00 00 00       	mov    $0x0,%eax
  802194:	eb f7                	jmp    80218d <devcons_read+0x36>

00802196 <cputchar>:
{
  802196:	f3 0f 1e fb          	endbr32 
  80219a:	55                   	push   %ebp
  80219b:	89 e5                	mov    %esp,%ebp
  80219d:	83 ec 20             	sub    $0x20,%esp
	char c = ch;
  8021a0:	8b 45 08             	mov    0x8(%ebp),%eax
  8021a3:	88 45 f7             	mov    %al,-0x9(%ebp)
	sys_cputs(&c, 1);
  8021a6:	6a 01                	push   $0x1
  8021a8:	8d 45 f7             	lea    -0x9(%ebp),%eax
  8021ab:	50                   	push   %eax
  8021ac:	e8 7c ef ff ff       	call   80112d <sys_cputs>
}
  8021b1:	83 c4 10             	add    $0x10,%esp
  8021b4:	c9                   	leave  
  8021b5:	c3                   	ret    

008021b6 <getchar>:
{
  8021b6:	f3 0f 1e fb          	endbr32 
  8021ba:	55                   	push   %ebp
  8021bb:	89 e5                	mov    %esp,%ebp
  8021bd:	83 ec 1c             	sub    $0x1c,%esp
	r = read(0, &c, 1);
  8021c0:	6a 01                	push   $0x1
  8021c2:	8d 45 f7             	lea    -0x9(%ebp),%eax
  8021c5:	50                   	push   %eax
  8021c6:	6a 00                	push   $0x0
  8021c8:	e8 5f f6 ff ff       	call   80182c <read>
	if (r < 0)
  8021cd:	83 c4 10             	add    $0x10,%esp
  8021d0:	85 c0                	test   %eax,%eax
  8021d2:	78 06                	js     8021da <getchar+0x24>
	if (r < 1)
  8021d4:	74 06                	je     8021dc <getchar+0x26>
	return c;
  8021d6:	0f b6 45 f7          	movzbl -0x9(%ebp),%eax
}
  8021da:	c9                   	leave  
  8021db:	c3                   	ret    
		return -E_EOF;
  8021dc:	b8 f8 ff ff ff       	mov    $0xfffffff8,%eax
  8021e1:	eb f7                	jmp    8021da <getchar+0x24>

008021e3 <iscons>:
{
  8021e3:	f3 0f 1e fb          	endbr32 
  8021e7:	55                   	push   %ebp
  8021e8:	89 e5                	mov    %esp,%ebp
  8021ea:	83 ec 20             	sub    $0x20,%esp
	if ((r = fd_lookup(fdnum, &fd)) < 0)
  8021ed:	8d 45 f4             	lea    -0xc(%ebp),%eax
  8021f0:	50                   	push   %eax
  8021f1:	ff 75 08             	pushl  0x8(%ebp)
  8021f4:	e8 b0 f3 ff ff       	call   8015a9 <fd_lookup>
  8021f9:	83 c4 10             	add    $0x10,%esp
  8021fc:	85 c0                	test   %eax,%eax
  8021fe:	78 11                	js     802211 <iscons+0x2e>
	return fd->fd_dev_id == devcons.dev_id;
  802200:	8b 45 f4             	mov    -0xc(%ebp),%eax
  802203:	8b 15 40 30 80 00    	mov    0x803040,%edx
  802209:	39 10                	cmp    %edx,(%eax)
  80220b:	0f 94 c0             	sete   %al
  80220e:	0f b6 c0             	movzbl %al,%eax
}
  802211:	c9                   	leave  
  802212:	c3                   	ret    

00802213 <opencons>:
{
  802213:	f3 0f 1e fb          	endbr32 
  802217:	55                   	push   %ebp
  802218:	89 e5                	mov    %esp,%ebp
  80221a:	83 ec 24             	sub    $0x24,%esp
	if ((r = fd_alloc(&fd)) < 0)
  80221d:	8d 45 f4             	lea    -0xc(%ebp),%eax
  802220:	50                   	push   %eax
  802221:	e8 2d f3 ff ff       	call   801553 <fd_alloc>
  802226:	83 c4 10             	add    $0x10,%esp
  802229:	85 c0                	test   %eax,%eax
  80222b:	78 3a                	js     802267 <opencons+0x54>
	if ((r = sys_page_alloc(0, fd, PTE_P|PTE_U|PTE_W|PTE_SHARE)) < 0)
  80222d:	83 ec 04             	sub    $0x4,%esp
  802230:	68 07 04 00 00       	push   $0x407
  802235:	ff 75 f4             	pushl  -0xc(%ebp)
  802238:	6a 00                	push   $0x0
  80223a:	e8 be ef ff ff       	call   8011fd <sys_page_alloc>
  80223f:	83 c4 10             	add    $0x10,%esp
  802242:	85 c0                	test   %eax,%eax
  802244:	78 21                	js     802267 <opencons+0x54>
	fd->fd_dev_id = devcons.dev_id;
  802246:	8b 45 f4             	mov    -0xc(%ebp),%eax
  802249:	8b 15 40 30 80 00    	mov    0x803040,%edx
  80224f:	89 10                	mov    %edx,(%eax)
	fd->fd_omode = O_RDWR;
  802251:	8b 45 f4             	mov    -0xc(%ebp),%eax
  802254:	c7 40 08 02 00 00 00 	movl   $0x2,0x8(%eax)
	return fd2num(fd);
  80225b:	83 ec 0c             	sub    $0xc,%esp
  80225e:	50                   	push   %eax
  80225f:	e8 c0 f2 ff ff       	call   801524 <fd2num>
  802264:	83 c4 10             	add    $0x10,%esp
}
  802267:	c9                   	leave  
  802268:	c3                   	ret    

00802269 <pageref>:
#include <inc/lib.h>

int
pageref(void *v)
{
  802269:	f3 0f 1e fb          	endbr32 
  80226d:	55                   	push   %ebp
  80226e:	89 e5                	mov    %esp,%ebp
  802270:	8b 45 08             	mov    0x8(%ebp),%eax
	pte_t pte;

	if (!(uvpd[PDX(v)] & PTE_P))
  802273:	89 c2                	mov    %eax,%edx
  802275:	c1 ea 16             	shr    $0x16,%edx
  802278:	8b 0c 95 00 d0 7b ef 	mov    -0x10843000(,%edx,4),%ecx
		return 0;
  80227f:	ba 00 00 00 00       	mov    $0x0,%edx
	if (!(uvpd[PDX(v)] & PTE_P))
  802284:	f6 c1 01             	test   $0x1,%cl
  802287:	74 1c                	je     8022a5 <pageref+0x3c>
	pte = uvpt[PGNUM(v)];
  802289:	c1 e8 0c             	shr    $0xc,%eax
  80228c:	8b 04 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%eax
	if (!(pte & PTE_P))
  802293:	a8 01                	test   $0x1,%al
  802295:	74 0e                	je     8022a5 <pageref+0x3c>
		return 0;
	return pages[PGNUM(pte)].pp_ref;
  802297:	c1 e8 0c             	shr    $0xc,%eax
  80229a:	0f b7 14 c5 04 00 00 	movzwl -0x10fffffc(,%eax,8),%edx
  8022a1:	ef 
  8022a2:	0f b7 d2             	movzwl %dx,%edx
}
  8022a5:	89 d0                	mov    %edx,%eax
  8022a7:	5d                   	pop    %ebp
  8022a8:	c3                   	ret    
  8022a9:	66 90                	xchg   %ax,%ax
  8022ab:	66 90                	xchg   %ax,%ax
  8022ad:	66 90                	xchg   %ax,%ax
  8022af:	90                   	nop

008022b0 <__udivdi3>:
  8022b0:	f3 0f 1e fb          	endbr32 
  8022b4:	55                   	push   %ebp
  8022b5:	57                   	push   %edi
  8022b6:	56                   	push   %esi
  8022b7:	53                   	push   %ebx
  8022b8:	83 ec 1c             	sub    $0x1c,%esp
  8022bb:	8b 54 24 3c          	mov    0x3c(%esp),%edx
  8022bf:	8b 6c 24 30          	mov    0x30(%esp),%ebp
  8022c3:	8b 74 24 34          	mov    0x34(%esp),%esi
  8022c7:	8b 5c 24 38          	mov    0x38(%esp),%ebx
  8022cb:	85 d2                	test   %edx,%edx
  8022cd:	75 19                	jne    8022e8 <__udivdi3+0x38>
  8022cf:	39 f3                	cmp    %esi,%ebx
  8022d1:	76 4d                	jbe    802320 <__udivdi3+0x70>
  8022d3:	31 ff                	xor    %edi,%edi
  8022d5:	89 e8                	mov    %ebp,%eax
  8022d7:	89 f2                	mov    %esi,%edx
  8022d9:	f7 f3                	div    %ebx
  8022db:	89 fa                	mov    %edi,%edx
  8022dd:	83 c4 1c             	add    $0x1c,%esp
  8022e0:	5b                   	pop    %ebx
  8022e1:	5e                   	pop    %esi
  8022e2:	5f                   	pop    %edi
  8022e3:	5d                   	pop    %ebp
  8022e4:	c3                   	ret    
  8022e5:	8d 76 00             	lea    0x0(%esi),%esi
  8022e8:	39 f2                	cmp    %esi,%edx
  8022ea:	76 14                	jbe    802300 <__udivdi3+0x50>
  8022ec:	31 ff                	xor    %edi,%edi
  8022ee:	31 c0                	xor    %eax,%eax
  8022f0:	89 fa                	mov    %edi,%edx
  8022f2:	83 c4 1c             	add    $0x1c,%esp
  8022f5:	5b                   	pop    %ebx
  8022f6:	5e                   	pop    %esi
  8022f7:	5f                   	pop    %edi
  8022f8:	5d                   	pop    %ebp
  8022f9:	c3                   	ret    
  8022fa:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
  802300:	0f bd fa             	bsr    %edx,%edi
  802303:	83 f7 1f             	xor    $0x1f,%edi
  802306:	75 48                	jne    802350 <__udivdi3+0xa0>
  802308:	39 f2                	cmp    %esi,%edx
  80230a:	72 06                	jb     802312 <__udivdi3+0x62>
  80230c:	31 c0                	xor    %eax,%eax
  80230e:	39 eb                	cmp    %ebp,%ebx
  802310:	77 de                	ja     8022f0 <__udivdi3+0x40>
  802312:	b8 01 00 00 00       	mov    $0x1,%eax
  802317:	eb d7                	jmp    8022f0 <__udivdi3+0x40>
  802319:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
  802320:	89 d9                	mov    %ebx,%ecx
  802322:	85 db                	test   %ebx,%ebx
  802324:	75 0b                	jne    802331 <__udivdi3+0x81>
  802326:	b8 01 00 00 00       	mov    $0x1,%eax
  80232b:	31 d2                	xor    %edx,%edx
  80232d:	f7 f3                	div    %ebx
  80232f:	89 c1                	mov    %eax,%ecx
  802331:	31 d2                	xor    %edx,%edx
  802333:	89 f0                	mov    %esi,%eax
  802335:	f7 f1                	div    %ecx
  802337:	89 c6                	mov    %eax,%esi
  802339:	89 e8                	mov    %ebp,%eax
  80233b:	89 f7                	mov    %esi,%edi
  80233d:	f7 f1                	div    %ecx
  80233f:	89 fa                	mov    %edi,%edx
  802341:	83 c4 1c             	add    $0x1c,%esp
  802344:	5b                   	pop    %ebx
  802345:	5e                   	pop    %esi
  802346:	5f                   	pop    %edi
  802347:	5d                   	pop    %ebp
  802348:	c3                   	ret    
  802349:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
  802350:	89 f9                	mov    %edi,%ecx
  802352:	b8 20 00 00 00       	mov    $0x20,%eax
  802357:	29 f8                	sub    %edi,%eax
  802359:	d3 e2                	shl    %cl,%edx
  80235b:	89 54 24 08          	mov    %edx,0x8(%esp)
  80235f:	89 c1                	mov    %eax,%ecx
  802361:	89 da                	mov    %ebx,%edx
  802363:	d3 ea                	shr    %cl,%edx
  802365:	8b 4c 24 08          	mov    0x8(%esp),%ecx
  802369:	09 d1                	or     %edx,%ecx
  80236b:	89 f2                	mov    %esi,%edx
  80236d:	89 4c 24 08          	mov    %ecx,0x8(%esp)
  802371:	89 f9                	mov    %edi,%ecx
  802373:	d3 e3                	shl    %cl,%ebx
  802375:	89 c1                	mov    %eax,%ecx
  802377:	d3 ea                	shr    %cl,%edx
  802379:	89 f9                	mov    %edi,%ecx
  80237b:	89 5c 24 0c          	mov    %ebx,0xc(%esp)
  80237f:	89 eb                	mov    %ebp,%ebx
  802381:	d3 e6                	shl    %cl,%esi
  802383:	89 c1                	mov    %eax,%ecx
  802385:	d3 eb                	shr    %cl,%ebx
  802387:	09 de                	or     %ebx,%esi
  802389:	89 f0                	mov    %esi,%eax
  80238b:	f7 74 24 08          	divl   0x8(%esp)
  80238f:	89 d6                	mov    %edx,%esi
  802391:	89 c3                	mov    %eax,%ebx
  802393:	f7 64 24 0c          	mull   0xc(%esp)
  802397:	39 d6                	cmp    %edx,%esi
  802399:	72 15                	jb     8023b0 <__udivdi3+0x100>
  80239b:	89 f9                	mov    %edi,%ecx
  80239d:	d3 e5                	shl    %cl,%ebp
  80239f:	39 c5                	cmp    %eax,%ebp
  8023a1:	73 04                	jae    8023a7 <__udivdi3+0xf7>
  8023a3:	39 d6                	cmp    %edx,%esi
  8023a5:	74 09                	je     8023b0 <__udivdi3+0x100>
  8023a7:	89 d8                	mov    %ebx,%eax
  8023a9:	31 ff                	xor    %edi,%edi
  8023ab:	e9 40 ff ff ff       	jmp    8022f0 <__udivdi3+0x40>
  8023b0:	8d 43 ff             	lea    -0x1(%ebx),%eax
  8023b3:	31 ff                	xor    %edi,%edi
  8023b5:	e9 36 ff ff ff       	jmp    8022f0 <__udivdi3+0x40>
  8023ba:	66 90                	xchg   %ax,%ax
  8023bc:	66 90                	xchg   %ax,%ax
  8023be:	66 90                	xchg   %ax,%ax

008023c0 <__umoddi3>:
  8023c0:	f3 0f 1e fb          	endbr32 
  8023c4:	55                   	push   %ebp
  8023c5:	57                   	push   %edi
  8023c6:	56                   	push   %esi
  8023c7:	53                   	push   %ebx
  8023c8:	83 ec 1c             	sub    $0x1c,%esp
  8023cb:	8b 44 24 3c          	mov    0x3c(%esp),%eax
  8023cf:	8b 74 24 30          	mov    0x30(%esp),%esi
  8023d3:	8b 5c 24 34          	mov    0x34(%esp),%ebx
  8023d7:	8b 7c 24 38          	mov    0x38(%esp),%edi
  8023db:	85 c0                	test   %eax,%eax
  8023dd:	75 19                	jne    8023f8 <__umoddi3+0x38>
  8023df:	39 df                	cmp    %ebx,%edi
  8023e1:	76 5d                	jbe    802440 <__umoddi3+0x80>
  8023e3:	89 f0                	mov    %esi,%eax
  8023e5:	89 da                	mov    %ebx,%edx
  8023e7:	f7 f7                	div    %edi
  8023e9:	89 d0                	mov    %edx,%eax
  8023eb:	31 d2                	xor    %edx,%edx
  8023ed:	83 c4 1c             	add    $0x1c,%esp
  8023f0:	5b                   	pop    %ebx
  8023f1:	5e                   	pop    %esi
  8023f2:	5f                   	pop    %edi
  8023f3:	5d                   	pop    %ebp
  8023f4:	c3                   	ret    
  8023f5:	8d 76 00             	lea    0x0(%esi),%esi
  8023f8:	89 f2                	mov    %esi,%edx
  8023fa:	39 d8                	cmp    %ebx,%eax
  8023fc:	76 12                	jbe    802410 <__umoddi3+0x50>
  8023fe:	89 f0                	mov    %esi,%eax
  802400:	89 da                	mov    %ebx,%edx
  802402:	83 c4 1c             	add    $0x1c,%esp
  802405:	5b                   	pop    %ebx
  802406:	5e                   	pop    %esi
  802407:	5f                   	pop    %edi
  802408:	5d                   	pop    %ebp
  802409:	c3                   	ret    
  80240a:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
  802410:	0f bd e8             	bsr    %eax,%ebp
  802413:	83 f5 1f             	xor    $0x1f,%ebp
  802416:	75 50                	jne    802468 <__umoddi3+0xa8>
  802418:	39 d8                	cmp    %ebx,%eax
  80241a:	0f 82 e0 00 00 00    	jb     802500 <__umoddi3+0x140>
  802420:	89 d9                	mov    %ebx,%ecx
  802422:	39 f7                	cmp    %esi,%edi
  802424:	0f 86 d6 00 00 00    	jbe    802500 <__umoddi3+0x140>
  80242a:	89 d0                	mov    %edx,%eax
  80242c:	89 ca                	mov    %ecx,%edx
  80242e:	83 c4 1c             	add    $0x1c,%esp
  802431:	5b                   	pop    %ebx
  802432:	5e                   	pop    %esi
  802433:	5f                   	pop    %edi
  802434:	5d                   	pop    %ebp
  802435:	c3                   	ret    
  802436:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
  80243d:	8d 76 00             	lea    0x0(%esi),%esi
  802440:	89 fd                	mov    %edi,%ebp
  802442:	85 ff                	test   %edi,%edi
  802444:	75 0b                	jne    802451 <__umoddi3+0x91>
  802446:	b8 01 00 00 00       	mov    $0x1,%eax
  80244b:	31 d2                	xor    %edx,%edx
  80244d:	f7 f7                	div    %edi
  80244f:	89 c5                	mov    %eax,%ebp
  802451:	89 d8                	mov    %ebx,%eax
  802453:	31 d2                	xor    %edx,%edx
  802455:	f7 f5                	div    %ebp
  802457:	89 f0                	mov    %esi,%eax
  802459:	f7 f5                	div    %ebp
  80245b:	89 d0                	mov    %edx,%eax
  80245d:	31 d2                	xor    %edx,%edx
  80245f:	eb 8c                	jmp    8023ed <__umoddi3+0x2d>
  802461:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
  802468:	89 e9                	mov    %ebp,%ecx
  80246a:	ba 20 00 00 00       	mov    $0x20,%edx
  80246f:	29 ea                	sub    %ebp,%edx
  802471:	d3 e0                	shl    %cl,%eax
  802473:	89 44 24 08          	mov    %eax,0x8(%esp)
  802477:	89 d1                	mov    %edx,%ecx
  802479:	89 f8                	mov    %edi,%eax
  80247b:	d3 e8                	shr    %cl,%eax
  80247d:	8b 4c 24 08          	mov    0x8(%esp),%ecx
  802481:	89 54 24 04          	mov    %edx,0x4(%esp)
  802485:	8b 54 24 04          	mov    0x4(%esp),%edx
  802489:	09 c1                	or     %eax,%ecx
  80248b:	89 d8                	mov    %ebx,%eax
  80248d:	89 4c 24 08          	mov    %ecx,0x8(%esp)
  802491:	89 e9                	mov    %ebp,%ecx
  802493:	d3 e7                	shl    %cl,%edi
  802495:	89 d1                	mov    %edx,%ecx
  802497:	d3 e8                	shr    %cl,%eax
  802499:	89 e9                	mov    %ebp,%ecx
  80249b:	89 7c 24 0c          	mov    %edi,0xc(%esp)
  80249f:	d3 e3                	shl    %cl,%ebx
  8024a1:	89 c7                	mov    %eax,%edi
  8024a3:	89 d1                	mov    %edx,%ecx
  8024a5:	89 f0                	mov    %esi,%eax
  8024a7:	d3 e8                	shr    %cl,%eax
  8024a9:	89 e9                	mov    %ebp,%ecx
  8024ab:	89 fa                	mov    %edi,%edx
  8024ad:	d3 e6                	shl    %cl,%esi
  8024af:	09 d8                	or     %ebx,%eax
  8024b1:	f7 74 24 08          	divl   0x8(%esp)
  8024b5:	89 d1                	mov    %edx,%ecx
  8024b7:	89 f3                	mov    %esi,%ebx
  8024b9:	f7 64 24 0c          	mull   0xc(%esp)
  8024bd:	89 c6                	mov    %eax,%esi
  8024bf:	89 d7                	mov    %edx,%edi
  8024c1:	39 d1                	cmp    %edx,%ecx
  8024c3:	72 06                	jb     8024cb <__umoddi3+0x10b>
  8024c5:	75 10                	jne    8024d7 <__umoddi3+0x117>
  8024c7:	39 c3                	cmp    %eax,%ebx
  8024c9:	73 0c                	jae    8024d7 <__umoddi3+0x117>
  8024cb:	2b 44 24 0c          	sub    0xc(%esp),%eax
  8024cf:	1b 54 24 08          	sbb    0x8(%esp),%edx
  8024d3:	89 d7                	mov    %edx,%edi
  8024d5:	89 c6                	mov    %eax,%esi
  8024d7:	89 ca                	mov    %ecx,%edx
  8024d9:	0f b6 4c 24 04       	movzbl 0x4(%esp),%ecx
  8024de:	29 f3                	sub    %esi,%ebx
  8024e0:	19 fa                	sbb    %edi,%edx
  8024e2:	89 d0                	mov    %edx,%eax
  8024e4:	d3 e0                	shl    %cl,%eax
  8024e6:	89 e9                	mov    %ebp,%ecx
  8024e8:	d3 eb                	shr    %cl,%ebx
  8024ea:	d3 ea                	shr    %cl,%edx
  8024ec:	09 d8                	or     %ebx,%eax
  8024ee:	83 c4 1c             	add    $0x1c,%esp
  8024f1:	5b                   	pop    %ebx
  8024f2:	5e                   	pop    %esi
  8024f3:	5f                   	pop    %edi
  8024f4:	5d                   	pop    %ebp
  8024f5:	c3                   	ret    
  8024f6:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
  8024fd:	8d 76 00             	lea    0x0(%esi),%esi
  802500:	29 fe                	sub    %edi,%esi
  802502:	19 c3                	sbb    %eax,%ebx
  802504:	89 f2                	mov    %esi,%edx
  802506:	89 d9                	mov    %ebx,%ecx
  802508:	e9 1d ff ff ff       	jmp    80242a <__umoddi3+0x6a>
